Skip to content
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

Wrong metric name/location for pg_stat_replication_pg_current_wal_lsn_bytes #1018

Open
kautkata opened this issue Apr 10, 2024 · 0 comments
Open

Comments

@kautkata
Copy link

What did you do?
I tried to figure out that actually get's returned by pg_stat_replication_pg_wal_lsn_diff metric, so I reviewed your code, to be precise

What did you expect to see?
Replication related data gathering.

What did you see instead? Under which circumstances?
Total byte count written in wal over database lifetime.
PostgreSQL documentation states:

pg_wal_lsn_diff ( lsn1 pg_lsn, lsn2 pg_lsn ) → numeric
Calculates the difference in bytes (lsn1 - lsn2) between two write-ahead log locations. This can be used with pg_stat_replication or some of the functions shown in Table 9.87 to get the replication lag.

and pg_lsn('0/0') in essence will return beginning of the wal so it's total bytes written in the wall. Metric it self is sane but it's not related to replication and it could/should be gathered for all database instances despite what pg_is_in_recovery() states

Environment
N/A

  • System information: Linux 5.10.167-147.601.amzn2.x86_64 x86_64

  • postgres_exporter version issues applies to latest version as well:

postgres_exporter, version 0.11.1 (branch: HEAD, revision: b5fd246)
build user: root@a2c981f603ff
build date: 20220818-20:58:17
go version: go1.18.5
platform: linux/amd64

  • postgres_exporter flags:
    N/A

  • PostgreSQL version: 14.6

  • Logs:
    N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant