diff --git a/operator/src/metrics.rs b/operator/src/metrics.rs index 07ed4ad..5bca8ee 100644 --- a/operator/src/metrics.rs +++ b/operator/src/metrics.rs @@ -137,6 +137,8 @@ pub async fn run_metrics_collector(state: Arc) { let config = get_config(); let mut last_execution = Utc::now(); + let current_namespace = client.default_namespace(); + loop { tokio::time::sleep(config.metrics_delay).await; @@ -154,10 +156,9 @@ pub async fn run_metrics_collector(state: Arc) { last_execution = end; let query = format!( - "sum by (user) (avg_over_time(pgbouncer_pools_client_active_connections{{user=~\"dmtr_.*\"}}[{interval}s] @ {})) > 0", + "sum by (user) (avg_over_time(pgbouncer_pools_client_active_connections{{user=~\"dmtr_.*\", namespace=\"{current_namespace}\"}}[{interval}s] @ {})) > 0", end.timestamp_millis() / 1000 ); - dbg!(&query); let response = collect_prometheus_metrics(config, query).await; if let Err(err) = response {