From 0e0be5cdf76fa0345fa414ede687fef025c21978 Mon Sep 17 00:00:00 2001 From: Erki Esken Date: Tue, 4 Mar 2025 13:34:30 +0200 Subject: [PATCH 1/2] Rename the 'app' label on metrics to 'appname' This corresponds better to the name used in connstring (appName). Also it will not conflict with common kubernetes labels that often get assigned 'app'. Also see: https://www.mongodb.com/docs/manual/reference/connection-string-options/#miscellaneous-configuration https://kubernetes.io/docs/reference/labels-annotations-taints/#app-kubernetes-io-name --- proxy/src/tracker.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/proxy/src/tracker.rs b/proxy/src/tracker.rs index 6c86069..1a892d1 100644 --- a/proxy/src/tracker.rs +++ b/proxy/src/tracker.rs @@ -17,14 +17,14 @@ use opentelemetry::KeyValue; use async_bson::Document; // Common labels for all op metrics -const OP_LABELS: &[&str] = &["client", "app", "op", "collection", "db", "replicaset", "server", "username"]; +const OP_LABELS: &[&str] = &["client", "appname", "op", "collection", "db", "replicaset", "server", "username"]; lazy_static! { static ref APP_CONNECTION_COUNT_TOTAL: CounterVec = register_counter_vec!( "mongoproxy_app_connections_established_total", "Total number of client connections established", - &["app"]).unwrap(); + &["appname"]).unwrap(); // This is a separate counter because the app and user label values arrive at different // times (if at all). So there is no good way to determine if we have both. @@ -38,7 +38,7 @@ lazy_static! { register_counter_vec!( "mongoproxy_app_disconnections_total", "Total number of client disconnections", - &["app", "username"]).unwrap(); + &["appname", "username"]).unwrap(); static ref UNSUPPORTED_OPNAME_COUNTER: CounterVec = register_counter_vec!( From c16d95690ff564bc51100bf7e2cf0d5e9494e0df Mon Sep 17 00:00:00 2001 From: Erki Esken Date: Tue, 4 Mar 2025 14:08:06 +0200 Subject: [PATCH 2/2] Fix readme label documentation --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 23fd26d..74bb580 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ Per-request histograms: * `mongoproxy_client_request_bytes_total` - Request size distribution. * `mongoproxy_server_response_bytes_total` - Response size distribution. -All per-request metrics are labeled with `client` (IP address), `app` (appName from connection metadata), `op`, `collection`, `db`, `server` and `replicaset`. +All per-request metrics are labeled with `client` (IP address), `appname` (appName from connection metadata), `op`, `collection`, `db`, `server` and `replicaset`. Connection counters * `mongoproxy_client_connections_established_total`