Skip to content

Commit

Permalink
renamed metrics discovery api
Browse files Browse the repository at this point in the history
Signed-off-by: veds-g <[email protected]>
  • Loading branch information
veds-g committed Nov 4, 2024
1 parent 8515c8b commit 8555e77
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
2 changes: 1 addition & 1 deletion server/apis/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
4 changes: 2 additions & 2 deletions server/apis/v1/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
6 changes: 3 additions & 3 deletions server/apis/v1/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -160,7 +160,7 @@ func TestHandler_GetMetricsDiscovery(t *testing.T) {
}

// Call the handler
h.GetMetricsDiscovery(c)
h.DiscoverMetrics(c)

// Check response
var response NumaflowAPIResponse
Expand All @@ -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)
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion server/routes/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 8555e77

Please sign in to comment.