From e12628fe936769217dd28f537e834d10d5901289 Mon Sep 17 00:00:00 2001 From: Mikhail Kot Date: Fri, 15 Nov 2024 17:42:41 +0000 Subject: [PATCH] Collect max_connections metric (#9770) This will further allow us to expose this metric to users --- compute/etc/neon_collector.jsonnet | 1 + .../etc/sql_exporter/compute_max_connections.libsonnet | 10 ++++++++++ compute/etc/sql_exporter/compute_max_connections.sql | 1 + 3 files changed, 12 insertions(+) create mode 100644 compute/etc/sql_exporter/compute_max_connections.libsonnet create mode 100644 compute/etc/sql_exporter/compute_max_connections.sql diff --git a/compute/etc/neon_collector.jsonnet b/compute/etc/neon_collector.jsonnet index c6fa645b41..75d69c7b68 100644 --- a/compute/etc/neon_collector.jsonnet +++ b/compute/etc/neon_collector.jsonnet @@ -6,6 +6,7 @@ import 'sql_exporter/compute_backpressure_throttling_seconds.libsonnet', import 'sql_exporter/compute_current_lsn.libsonnet', import 'sql_exporter/compute_logical_snapshot_files.libsonnet', + import 'sql_exporter/compute_max_connections.libsonnet', import 'sql_exporter/compute_receive_lsn.libsonnet', import 'sql_exporter/compute_subscriptions_count.libsonnet', import 'sql_exporter/connection_counts.libsonnet', diff --git a/compute/etc/sql_exporter/compute_max_connections.libsonnet b/compute/etc/sql_exporter/compute_max_connections.libsonnet new file mode 100644 index 0000000000..69cfa1f19c --- /dev/null +++ b/compute/etc/sql_exporter/compute_max_connections.libsonnet @@ -0,0 +1,10 @@ +{ + metric_name: 'compute_max_connections', + type: 'gauge', + help: 'Max connections allowed for Postgres', + key_labels: null, + values: [ + 'max_connections', + ], + query: importstr 'sql_exporter/compute_max_connections.sql', +} diff --git a/compute/etc/sql_exporter/compute_max_connections.sql b/compute/etc/sql_exporter/compute_max_connections.sql new file mode 100644 index 0000000000..99a49483a6 --- /dev/null +++ b/compute/etc/sql_exporter/compute_max_connections.sql @@ -0,0 +1 @@ +SELECT current_setting('max_connections') as max_connections;