postgres_exporter icon indicating copy to clipboard operation
postgres_exporter copied to clipboard

fix: longRunningTransactionsAgeInSeconds

Open roock opened this issue 1 year ago • 1 comments

  • 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): Screenshot 2023-11-30 at 15 51 56

roock avatar Nov 30 '23 14:11 roock