Track application_name in connection_counts metric

It will help us understand what applications are exhausting the number
of direct database connections.

Signed-off-by: Tristan Partin <tristan@neon.tech>
This commit is contained in:
Tristan Partin
2024-11-14 10:20:27 -06:00
parent 1280b708f1
commit 837c68b6df
2 changed files with 2 additions and 1 deletions

View File

@@ -4,6 +4,7 @@
help: 'Connection counts',
key_labels: [
'datname',
'application_name',
'state',
],
values: [

View File

@@ -1 +1 @@
SELECT datname, state, count(*) AS count FROM pg_stat_activity WHERE state <> '' GROUP BY datname, state;
SELECT datname, application_name, state, count(*) AS count FROM pg_stat_activity WHERE state <> '' GROUP BY datname, state;