From a32d7c61afcfd0544f4e57940df3bad17fa123d1 Mon Sep 17 00:00:00 2001 From: Mahima Singh <105724608+smahima27@users.noreply.github.com> Date: Wed, 7 Jan 2026 14:47:22 +0530 Subject: [PATCH] Register circuit breaker metrics in Prometheus table --- lib/vmpooler/metrics/promstats.rb | 18 ++++++++++++++++++ lib/vmpooler/pool_manager.rb | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/vmpooler/metrics/promstats.rb b/lib/vmpooler/metrics/promstats.rb index d0e1ab9..23ec64e 100644 --- a/lib/vmpooler/metrics/promstats.rb +++ b/lib/vmpooler/metrics/promstats.rb @@ -353,6 +353,24 @@ module Vmpooler torun: %i[manager], docstring: 'vmpooler clone metrics', param_labels: %i[poolname] + }, + circuit_breaker: { + mtype: M_GAUGE, + torun: %i[manager], + docstring: 'Circuit breaker state and failure tracking', + param_labels: %i[metric_path] + }, + connection_pool: { + mtype: M_GAUGE, + torun: %i[manager], + docstring: 'Connection pool health metrics', + param_labels: %i[metric_path] + }, + adaptive_timeout: { + mtype: M_GAUGE, + torun: %i[manager], + docstring: 'Adaptive timeout statistics', + param_labels: %i[metric_path] } } end diff --git a/lib/vmpooler/pool_manager.rb b/lib/vmpooler/pool_manager.rb index fedc697..0580d33 100644 --- a/lib/vmpooler/pool_manager.rb +++ b/lib/vmpooler/pool_manager.rb @@ -1300,7 +1300,7 @@ module Vmpooler health = pool.health_status - # Push metrics + # Push metrics using metric_path pattern $metrics.gauge("connection_pool.#{provider_name}.available", health[:available]) $metrics.gauge("connection_pool.#{provider_name}.in_use", health[:in_use]) $metrics.gauge("connection_pool.#{provider_name}.utilization", health[:utilization])