Skip to content

Commit

Permalink
Refactoring: move prometheus endpoint to root
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky committed Nov 13, 2024
1 parent 936a8ab commit 8919da9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cmd/api/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func websocketSkipper(c echo.Context) bool {
}

func metricsSkipper(c echo.Context) bool {
return c.Path() == "/v1/metrics"
return c.Path() == "/metrics"
}

func postSkipper(c echo.Context) bool {
Expand Down Expand Up @@ -279,6 +279,10 @@ func initHandlers(ctx context.Context, e *echo.Echo, cfg Config, db postgres.Sto
ttlCache.Start(ctx)
ttlCacheMiddleware := cache.Middleware(ttlCache, nil)

if cfg.ApiConfig.Prometheus {
e.GET("/metrics", echoprometheus.NewHandler())
}

v1 := e.Group("v1")

stateHandlers := handler.NewStateHandler(db.State, db.Validator, cfg.Indexer.Name)
Expand Down Expand Up @@ -441,10 +445,6 @@ func initHandlers(ctx context.Context, e *echo.Echo, cfg Config, db postgres.Sto
vesting.GET("/:id/periods", vestingHandler.Periods)
}

if cfg.ApiConfig.Prometheus {
v1.GET("/metrics", echoprometheus.NewHandler())
}

htmlContent, err := scalar.ApiReferenceHTML(&scalar.Options{
SpecURL: "./docs/swagger.json",
CustomOptions: scalar.CustomOptions{
Expand Down

0 comments on commit 8919da9

Please sign in to comment.