From fd28c8d8057a4c7ab9d3b95a75602c931283078a Mon Sep 17 00:00:00 2001 From: Travis Nielsen Date: Fri, 14 Jun 2024 15:38:34 -0600 Subject: [PATCH] monitoring: set honor labels on the service monitor The endpoint property honorLabels: true should be set so that different rgw instances can show separate prometheus values instead of being aggregated. Signed-off-by: Travis Nielsen (cherry picked from commit eed10334854b1017f0c145f0cac4f0ff9abb9f53) --- deploy/examples/monitoring/service-monitor.yaml | 1 + pkg/operator/k8sutil/prometheus.go | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/deploy/examples/monitoring/service-monitor.yaml b/deploy/examples/monitoring/service-monitor.yaml index 2bd28b694..188768e67 100644 --- a/deploy/examples/monitoring/service-monitor.yaml +++ b/deploy/examples/monitoring/service-monitor.yaml @@ -17,3 +17,4 @@ spec: - port: http-metrics path: /metrics interval: 10s + honorLabels: true diff --git a/pkg/operator/k8sutil/prometheus.go b/pkg/operator/k8sutil/prometheus.go index ea9600237..48f69f329 100644 --- a/pkg/operator/k8sutil/prometheus.go +++ b/pkg/operator/k8sutil/prometheus.go @@ -61,9 +61,10 @@ func GetServiceMonitor(name string, namespace string, portName string) *monitori }, Endpoints: []monitoringv1.Endpoint{ { - Port: portName, - Path: "/metrics", - Interval: "10s", + Port: portName, + Path: "/metrics", + Interval: "10s", + HonorLabels: true, }, }, },