From d48229f50f9253026267083f9b31513754d03365 Mon Sep 17 00:00:00 2001 From: Alexey Kondratov Date: Mon, 26 Aug 2024 14:34:18 +0200 Subject: [PATCH] feat(compute): Introduce new compute_subscriptions_count metric (#8796) ## Problem We need some metric to sneak peek into how many people use inbound logical replication (Neon is a subscriber). ## Summary of changes This commit adds a new metric `compute_subscriptions_count`, which is number of subscriptions grouped by enabled/disabled state. Resolves: neondatabase/cloud#16146 --- vm-image-spec.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/vm-image-spec.yaml b/vm-image-spec.yaml index 622004b931..0bacb63509 100644 --- a/vm-image-spec.yaml +++ b/vm-image-spec.yaml @@ -356,6 +356,17 @@ files: from pg_replication_slots where slot_type = 'logical'; + - metric_name: compute_subscriptions_count + type: gauge + help: 'Number of logical replication subscriptions grouped by enabled/disabled' + key_labels: + - enabled + values: [subscriptions_count] + query: | + select subenabled::text as enabled, count(*) as subscriptions_count + from pg_subscription + group by subenabled; + - metric_name: retained_wal type: gauge help: 'Retained WAL in inactive replication slots'