Update pg_stat_activity query (#1012)

Signed-off-by: Mariia Kerimova <mashun4ek@gmail.com>
This commit is contained in:
Mariia Kerimova
2021-05-30 10:31:49 +08:00
committed by GitHub
parent ccbf1c455e
commit 5374d5beba
2 changed files with 9 additions and 9 deletions
@@ -2,7 +2,7 @@ apiVersion: v2
appVersion: "0.9.0"
description: A Helm chart for prometheus postgres-exporter
name: prometheus-postgres-exporter
version: 2.3.3
version: 2.3.4
home: https://github.com/prometheus-community/postgres_exporter
sources:
- https://github.com/prometheus-community/postgres_exporter
@@ -351,14 +351,14 @@ config:
usage: "COUNTER"
description: "Total time the statement spent writing blocks, in milliseconds (if track_io_timing is enabled, otherwise zero)"
pg_stat_activity:
pg_stat_activity_idle:
query: |
WITH
metrics AS (
SELECT
application_name,
SUM(EXTRACT(EPOCH FROM (CURRENT_TIMESTAMP - state_change))::bigint)::float AS process_idle_seconds_sum,
COUNT(*) AS process_idle_seconds_count
SUM(EXTRACT(EPOCH FROM (CURRENT_TIMESTAMP - state_change))::bigint)::float AS process_seconds_sum,
COUNT(*) AS process_seconds_count
FROM pg_stat_activity
WHERE state = 'idle'
GROUP BY application_name
@@ -381,17 +381,17 @@ config:
)
SELECT
application_name,
process_idle_seconds_sum,
process_idle_seconds_count,
ARRAY_AGG(le) AS process_idle_seconds,
ARRAY_AGG(bucket) AS process_idle_seconds_bucket
process_seconds_sum,
process_seconds_count,
ARRAY_AGG(le) AS process_seconds,
ARRAY_AGG(bucket) AS process_seconds_bucket
FROM metrics JOIN buckets USING (application_name)
GROUP BY 1, 2, 3
metrics:
- application_name:
usage: "LABEL"
description: "Application Name"
- process_idle_seconds:
- process_seconds:
usage: "HISTOGRAM"
description: "Idle time of server processes"