rapidloop / pgmetrics

Collect and display information and stats from a running PostgreSQL server
https://pgmetrics.io
Apache License 2.0
960 stars 65 forks source link

Skip collecting wal if db is aurora #55

Closed caflamand closed 1 year ago

caflamand commented 1 year ago

Hello!

I'm was trying to run pgmetrics from linux to get metrics for our AWS RDS Aurora Cluster (14.4), but I was getting the following fatal error when trying to do so.

pgmetrics: pg_stat_wal query failed: pq: Function pg_stat_get_wal() is currently not supported for Aurora

Aurora not supporting wal metrics seems to be a known issue for pgmetrics, see below: https://github.com/rapidloop/pgmetrics/blob/35516b55da71f8aa05b84f360032e9ca68b6d830/collector/collect.go#L854-L860

After some investigation, I found that the error was being raised by the getWal() function, which is missing the c.isAWSAurora() check. https://github.com/rapidloop/pgmetrics/blob/35516b55da71f8aa05b84f360032e9ca68b6d830/collector/collect.go#L2417-L2436

I recompiled locally with the check and it fixed my issue.

The call to the getWal() function has been introduced more than a year ago. I couldn't find any related issues in the repo, am I the first one to have this issue?

mdevan commented 1 year ago

Thanks for the report and fix. We'll merge/provide a fix in the upcoming release (likely next week).

mdevan commented 1 year ago

Available in release v1.14.0.

(Note: Also use latest pgdash CLI v1.10.0 to send to pgDash server.)