Skip to content

Error when running the postgres exporter with postgres 17 #2388

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cipherself opened this issue Jan 11, 2025 · 6 comments · Fixed by #2972
Closed

Error when running the postgres exporter with postgres 17 #2388

cipherself opened this issue Jan 11, 2025 · 6 comments · Fixed by #2972
Labels
bug Something isn't working frozen-due-to-age

Comments

@cipherself
Copy link

cipherself commented Jan 11, 2025

What's wrong?

postgres 17 removed the checkpoints_timed column from pg_stat_pgwriter causing the following error

alloy  | ts=2025-01-11T23:43:24.476671414Z level=error msg="collector failed" component_path=/ component_id=prometheus.exporter.postgres.dbname name=stat_bgwriter duration_seconds=0.005531275 err="pq: column \"checkpoints_timed\" does not exist

Apparently this has been fixed on the master branch of postgres-exporter prometheus-community/postgres_exporter#1072 but still hasn't been released.

Steps to reproduce

  1. Run a postgres 17 database
  2. Configure alloy to scrape metrics from it

System information

Linux 6.1.0-25-amd64

Software version

v1.5.1

Configuration

prometheus.exporter.postgres "testdb" {
  data_source_names = ["postgresql://monitoring:monitoring@db:5432/testdb?sslmode=disable"]
}

prometheus.scrape "testdb" {
  targets    = prometheus.exporter.postgres.testdb.targets
}

Logs

alloy  | ts=2025-01-11T23:43:24.476671414Z level=error msg="collector failed" component_path=/ component_id=prometheus.exporter.postgres.dbname name=stat_bgwriter duration_seconds=0.005531275 err="pq: column \"checkpoints_timed\" does not exist
@cipherself cipherself added the bug Something isn't working label Jan 11, 2025
@wildum
Copy link
Contributor

wildum commented Jan 16, 2025

hi, thanks for reporting this bug. We are currently running a fork of the postgres exporter. There is a todo to update our fork with upstream (https://github.com/grafana/alloy/blob/main/go.mod#L942). This bug is extra motivation to get it done :) @dehaansa you looked into this exporter recently, any pain points to get it updated?

@dehaansa
Copy link
Collaborator

Yeah, there were some relatively significant changes to get upstreamed, it might be more straightforward to cherry pick the fix for postgresl17 before continuing on the upstream work.

@moray95
Copy link

moray95 commented Feb 21, 2025

I am having the same issue with Alloy 1.6.1. Any ETA when this will be fixed?

@jozuas
Copy link

jozuas commented Feb 25, 2025

in the meanwhile postgres_exporter have released a fixed version themselves https://github.com/prometheus-community/postgres_exporter/releases/tag/v0.17.0

@dehaansa
Copy link
Collaborator

I've updated the fork of upstream postgres_exporter that Alloy uses, this should be fixed in the next release.

That said, if you disable the stat_bgwriter collector you should still be able to get most of your metrics while waiting for the next release. Next release is currently planned for April 7.

@dehaansa
Copy link
Collaborator

This was released early in 1.7.3 as we were pushing out a patch for some other minor issues and it tagged along.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working frozen-due-to-age
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants