From 8555e7724908e0619e93a9d058e7ea6f462c2be3 Mon Sep 17 00:00:00 2001 From: veds-g Date: Mon, 4 Nov 2024 14:21:18 +0530 Subject: [PATCH] renamed metrics discovery api Signed-off-by: veds-g --- go.mod | 2 +- go.sum | 4 ++-- server/apis/interface.go | 2 +- server/apis/v1/handler.go | 4 ++-- server/apis/v1/handler_test.go | 6 +++--- server/routes/routes.go | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index 22ca740da..b5f17e6e4 100644 --- a/go.mod +++ b/go.mod @@ -32,7 +32,7 @@ require ( github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe github.com/nats-io/nats-server/v2 v2.10.20 github.com/nats-io/nats.go v1.37.0 - github.com/numaproj/numaflow-go v0.8.2-0.20241030023053-f6819383aa7b + github.com/numaproj/numaflow-go v0.8.2-0.20241030045800-8f4062fa3504 github.com/prometheus/client_golang v1.19.1 github.com/prometheus/client_model v0.6.1 github.com/prometheus/common v0.55.0 diff --git a/go.sum b/go.sum index c0bb7ce20..590a16f26 100644 --- a/go.sum +++ b/go.sum @@ -487,8 +487,8 @@ github.com/nats-io/nkeys v0.4.7/go.mod h1:kqXRgRDPlGy7nGaEDMuYzmiJCIAAWDK0IMBtDm github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/numaproj/numaflow-go v0.8.2-0.20241030023053-f6819383aa7b h1:UEhFHfBwe2DwtnYzdFteTZ2tKwMX739llzfebfEMGg4= -github.com/numaproj/numaflow-go v0.8.2-0.20241030023053-f6819383aa7b/go.mod h1:FaCMeV0V9SiLcVf2fwT+GeTJHNaK2gdQsTAIqQ4x7oc= +github.com/numaproj/numaflow-go v0.8.2-0.20241030045800-8f4062fa3504 h1:fTStj8pOZxFNDzs0t3evUxji2kraIbceUN7EOQGsu8Y= +github.com/numaproj/numaflow-go v0.8.2-0.20241030045800-8f4062fa3504/go.mod h1:FaCMeV0V9SiLcVf2fwT+GeTJHNaK2gdQsTAIqQ4x7oc= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= diff --git a/server/apis/interface.go b/server/apis/interface.go index f214a1b37..45b114420 100644 --- a/server/apis/interface.go +++ b/server/apis/interface.go @@ -50,5 +50,5 @@ type Handler interface { CreateMonoVertex(c *gin.Context) GetMonoVertexMetrics(c *gin.Context) GetMetricData(c *gin.Context) - GetMetricsDiscovery(c *gin.Context) + DiscoverMetrics(c *gin.Context) } diff --git a/server/apis/v1/handler.go b/server/apis/v1/handler.go index b415e6d72..5c4e85e01 100644 --- a/server/apis/v1/handler.go +++ b/server/apis/v1/handler.go @@ -1283,9 +1283,9 @@ func (h *handler) GetMetricData(c *gin.Context) { c.JSON(http.StatusOK, NewNumaflowAPIResponse(nil, result)) } -// GetMetricsDiscovery is used to provide a metrics list for each +// DiscoverMetrics is used to provide a metrics list for each // dimension along with necessary params and filters for a given object -func (h *handler) GetMetricsDiscovery(c *gin.Context) { +func (h *handler) DiscoverMetrics(c *gin.Context) { // Get the object for which the metrics are to be discovered // Ex. mono-vertex, pipeline, etc. object := c.Param("object") diff --git a/server/apis/v1/handler_test.go b/server/apis/v1/handler_test.go index 702eb3ec8..08a022d6c 100644 --- a/server/apis/v1/handler_test.go +++ b/server/apis/v1/handler_test.go @@ -57,7 +57,7 @@ func TestValidatePipelinePatch(t *testing.T) { } -func TestHandler_GetMetricsDiscovery(t *testing.T) { +func TestHandler_DiscoverMetrics(t *testing.T) { tests := []struct { name string object string @@ -160,7 +160,7 @@ func TestHandler_GetMetricsDiscovery(t *testing.T) { } // Call the handler - h.GetMetricsDiscovery(c) + h.DiscoverMetrics(c) // Check response var response NumaflowAPIResponse @@ -181,7 +181,7 @@ func TestHandler_GetMetricsDiscovery(t *testing.T) { } if !reflect.DeepEqual(got, tt.want) && len(got) != 0 { - t.Errorf("GetMetricsDiscovery() got = %v, want %v", got, tt.want) + t.Errorf("DiscoverMetrics() got = %v, want %v", got, tt.want) } }) } diff --git a/server/routes/routes.go b/server/routes/routes.go index 167cb7ae7..a6910fe39 100644 --- a/server/routes/routes.go +++ b/server/routes/routes.go @@ -173,7 +173,7 @@ func v1Routes(ctx context.Context, r gin.IRouter, dexObj *v1.DexObject, localUse // Get the time series data across different dimensions. r.POST("/metrics-proxy", handler.GetMetricData) // Discover the metrics for a given object type. - r.GET("/metrics-discovery/object/:object", handler.GetMetricsDiscovery) + r.GET("/metrics-discovery/object/:object", handler.DiscoverMetrics) } // authMiddleware is the middleware for AuthN/AuthZ.