From 6750c498ed9ad178b6cbcc8ac5e961baeb4b1951 Mon Sep 17 00:00:00 2001 From: Rahul Barigidad Date: Mon, 27 Jan 2025 11:12:09 +0000 Subject: [PATCH] [#25775] YSQL: Sticky conn as metrics for prometheus endpoint Summary: Sticky connections were introduced as a new metric in D40484, but were left out from being published to the prometheus endpoint. This patch pushes the same information to the prometheus-metrics endpoint in addition to the pre-existing connections endpoint. Jira: DB-15041 Test Plan: Jenkins: enable connection manager, all tests Verify that sticky conn metrics are available on prometheus endpoint on a local cluster Reviewers: skumar, mkumar, devansh.saxena, vpatibandla Reviewed By: mkumar, devansh.saxena Subscribers: yql Differential Revision: https://phorge.dev.yugabyte.com/D41484 --- src/yb/yql/pggate/webserver/ybc_pg_webserver_wrapper.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/yb/yql/pggate/webserver/ybc_pg_webserver_wrapper.cc b/src/yb/yql/pggate/webserver/ybc_pg_webserver_wrapper.cc index 18c14f3d9c9..19f1299daba 100644 --- a/src/yb/yql/pggate/webserver/ybc_pg_webserver_wrapper.cc +++ b/src/yb/yql/pggate/webserver/ybc_pg_webserver_wrapper.cc @@ -240,6 +240,10 @@ void emitYsqlConnectionManagerMetrics(PrometheusWriter *pwriter) { {"ysql_conn_mgr_avg_wait_time_ns", stats.avg_wait_time_ns, "gauge", "Avg wait time (in nanoseconds) for a logical connection to be attached to a physical " "connection"}); + ysql_conn_mgr_metrics.push_back( + {"ysql_conn_mgr_sticky_connections", stats.sticky_connections, "gauge", + "Number of logical connections attached to a physical connection for the lifetime of the " + "logical connection"}); ysql_conn_mgr_prometheus_attr[DATABASE] = stats.database_name; ysql_conn_mgr_prometheus_attr[USER] = stats.user_name;