postgres_exporter
postgres_exporter copied to clipboard
fix: longRunningTransactionsAgeInSeconds
- clock_timestamp will just return the current timestamp
- what we actually want to know is the lowest timestamp of the xact_start column
Please also see: https://github.com/prometheus-community/postgres_exporter/pull/836#discussion_r1295748514 and the original can be found here: https://gitlab.com/gitlab-cookbooks/gitlab-exporters/-/blob/master/templates/postgres_exporter/queries.yaml.erb#L954
(the originally proposed version MAX(EXTRACT(EPOCH FROM (clock_timestamp() - xact_start))) AS age_in_seconds
is also correct, but return the seconds, not the timestamp.
Using the current version the graphs look like this (flat line as this will always match the current time):