Skip to content

Commit

Permalink
Merge pull request #4 from ron96G/dev
Browse files Browse the repository at this point in the history
added /metrics to OpsSkipper;
  • Loading branch information
ron96G authored Sep 15, 2021
2 parents 809dece + b85af3c commit 31932af
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

var (
OpsSkipper = func(c echo.Context) bool {
return strings.HasPrefix(c.Path(), "/health") || strings.HasPrefix(c.Path(), "/ping") || c.Path() == "/"
return strings.HasPrefix(c.Path(), "/health") || strings.HasPrefix(c.Path(), "/ping") || c.Path() == "/metrics"
}

LoggerConfig = echo_mw.LoggerConfig{
Expand All @@ -31,6 +31,10 @@ var (
`,"request_length":${bytes_in},"response_length":${bytes_out}}` + "\n",
CustomTimeFormat: time.RFC3339,
}

RequestIDConfig = echo_mw.RequestIDConfig{
Skipper: OpsSkipper,
}
)

func NewAPI(prefix, addr string, client Client, stopChan <-chan struct{}, logger log.Logger, tlsCfg *tls.Config) *API {
Expand All @@ -46,7 +50,7 @@ func NewAPI(prefix, addr string, client Client, stopChan <-chan struct{}, logger

// general middleware
api.router.Use(echo_mw.Recover())
api.router.Use(echo_mw.RequestID())
api.router.Use(echo_mw.RequestIDWithConfig(RequestIDConfig))
api.router.Use(echo_mw.LoggerWithConfig(LoggerConfig))

// tracing middleware
Expand Down

0 comments on commit 31932af

Please sign in to comment.