mirror of
https://github.com/prometheus-community/postgres_exporter
synced 2025-05-12 12:58:06 +00:00
lock conflicts monitoring (#111)
This commit is contained in:
parent
a215869f1b
commit
aec5cf01b1
cmd/postgres_exporter
@ -225,6 +225,14 @@ var builtinMetricMaps = map[string]intermediateMetricMap{
|
||||
true,
|
||||
0,
|
||||
},
|
||||
"pg_lock_conflicts": {
|
||||
map[string]ColumnMapping{
|
||||
"blocking_pid": {LABEL, "PID of blocking session", nil, nil},
|
||||
"count": {GAUGE, "Number of blocked sessions", nil, nil},
|
||||
},
|
||||
true,
|
||||
0,
|
||||
},
|
||||
"pg_stat_replication": {
|
||||
map[string]ColumnMapping{
|
||||
"procpid": {DISCARD, "Process ID of a WAL sender process", nil, semver.MustParseRange("<9.2.0")},
|
||||
|
@ -70,7 +70,19 @@ var queryOverrides = map[string][]OverrideQuery{
|
||||
ON tmp.mode=tmp2.mode and pg_database.oid = tmp2.database ORDER BY 1`,
|
||||
},
|
||||
},
|
||||
|
||||
"pg_lock_conflicts": {
|
||||
{
|
||||
semver.MustParseRange(">0.0.0"),
|
||||
`SELECT blockinga.pid AS blocking_pid, count(*) as count
|
||||
FROM pg_catalog.pg_locks blockedl
|
||||
JOIN pg_stat_activity blockeda ON blockedl.pid = blockeda.pid
|
||||
JOIN pg_catalog.pg_locks blockingl ON(blockingl.transactionid=blockedl.transactionid
|
||||
AND blockedl.pid != blockingl.pid)
|
||||
JOIN pg_stat_activity blockinga ON blockingl.pid = blockinga.pid
|
||||
WHERE NOT blockedl.granted
|
||||
group by blocking_pid`,
|
||||
},
|
||||
},
|
||||
"pg_stat_replication": {
|
||||
{
|
||||
semver.MustParseRange(">=10.0.0"),
|
||||
|
Loading…
Reference in New Issue
Block a user