Description
Component(s)
receiver/postgresql
What happened?
Description
After updating to postgres 17, the scraper began throwing errors. This is caused by a change in some internal postgres tables. Some values of the pg_stat_bgwriter
were moved to the new table pg_stat_checkpointer
Documentation from postgres 16: https://www.postgresql.org/docs/16/monitoring-stats.html#MONITORING-PG-STAT-BGWRITER-VIEW
Documentation from postgres 17: https://www.postgresql.org/docs/17/monitoring-stats.html#MONITORING-PG-STAT-BGWRITER-VIEW
Steps to Reproduce
Configure the postgresqlreceiver to scrape metrics from a postgres 17 cluster
Expected Result
Metrics are scraped
Actual Result
Metrics are not scraped, error in log:
{"level":"error","ts":"2024-12-11T12:56:18.376Z","caller":"scraperhelper/obs_metrics.go:56","msg":"Error scraping metrics","kind":"receiver","name":"postgresql","data_type":"metrics","scraper":"postgresql","error":"pq: column \"checkpoints_req\" does not exist"}
There is also an error in the log of the postgres cluster:
column "checkpoints_req" does not exist
(SQL): SELECT
checkpoints_req AS checkpoint_req,
checkpoints_timed AS checkpoint_scheduled,
checkpoint_write_time AS checkpoint_duration_write,
checkpoint_sync_time AS checkpoint_duration_sync,
buffers_clean AS bg_writes,
buffers_backend AS backend_writes,
buffers_backend_fsync AS buffers_written_fsync,
buffers_checkpoint AS buffers_checkpoints,
buffers_alloc AS buffers_allocated,
maxwritten_clean AS maxwritten_count
FROM pg_stat_bgwriter;
Collector version
0.115.1
Environment information
Environment
OS: (e.g., "Ubuntu 20.04")
Compiler(if manually compiled): (e.g., "go 14.2")
OpenTelemetry Collector configuration
receivers:
postgresql:
endpoint: localhost:5432
username: ${env:POSTGRES_USER}
password: ${env:POSTGRES_PASSWORD}
tls:
insecure: true
processors:
batch: {}
exporters:
otlp:
endpoint: 10.1.20.4:5317
tls:
insecure: true
service:
pipelines:
metrics:
receivers:
- postgresql
processors:
- batch
exporters:
- otlp
Log output
{"level":"error","ts":"2024-12-11T12:48:18.383Z","caller":"scraperhelper/obs_metrics.go:56","msg":"Error scraping metrics","kind":"receiver","name":"postgresql","data_type":"metrics","scraper":"postgresql","error":"pq: column \"checkpoints_req\" does not exist"}
Additional context
No response