Skip to content

Commit

Permalink
[BACKPORT 2024.2][#25775] YSQL: Sticky conn as metrics for prometheus…
Browse files Browse the repository at this point in the history
… 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

Original commit: 6750c49 / D41484

**Merge conflicts**
On master, the file `src/yb/yql/pggate/webserver/pgsql_webserver_wrapper.cc` was renamed to `src/yb/yql/pggate/webserver/ybc_pg_webserver_wrapper.cc`. This change is not present on 2024.2 leading to some merge conflicts - just had to patch the same changes on the appropriate file for this back port diff

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: skumar

Subscribers: yql

Differential Revision: https://phorge.dev.yugabyte.com/D41546
  • Loading branch information
rahulb-yb committed Jan 31, 2025
1 parent 8768b15 commit 3a94fb9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/yb/yql/pggate/webserver/pgsql_webserver_wrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,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;

Expand Down

0 comments on commit 3a94fb9

Please sign in to comment.