From 257c85b2a1b43c59395b0d9eb6fb376a61a20e05 Mon Sep 17 00:00:00 2001 From: Shiva Krishna Merla Date: Fri, 20 Dec 2024 06:44:16 +0530 Subject: [PATCH] Update metrics endpoint for NIMs to be /v1/metrics as per latest API spec (#265) Signed-off-by: Shiva Krishna, Merla --- api/apps/v1alpha1/nimservice_types.go | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/api/apps/v1alpha1/nimservice_types.go b/api/apps/v1alpha1/nimservice_types.go index f4e010de..1ba66702 100644 --- a/api/apps/v1alpha1/nimservice_types.go +++ b/api/apps/v1alpha1/nimservice_types.go @@ -760,10 +760,22 @@ func (n *NIMService) GetServiceMonitorParams() *rendertypes.ServiceMonitorParams // Set Service Monitor spec smSpec := monitoringv1.ServiceMonitorSpec{ - NamespaceSelector: monitoringv1.NamespaceSelector{MatchNames: []string{n.Namespace}}, - Selector: metav1.LabelSelector{MatchLabels: n.GetServiceLabels()}, - Endpoints: []monitoringv1.Endpoint{{Port: "service-port", ScrapeTimeout: serviceMonitor.ScrapeTimeout, Interval: serviceMonitor.Interval}}, + NamespaceSelector: monitoringv1.NamespaceSelector{ + MatchNames: []string{n.Namespace}, + }, + Selector: metav1.LabelSelector{ + MatchLabels: n.GetServiceLabels(), + }, + Endpoints: []monitoringv1.Endpoint{ + { + Port: "service-port", + Path: "/v1/metrics", + ScrapeTimeout: serviceMonitor.ScrapeTimeout, + Interval: serviceMonitor.Interval, + }, + }, } + params.SMSpec = smSpec return params }