Skip to content

Commit

Permalink
add a new method in the app that help to define the prom registry
Browse files Browse the repository at this point in the history
Signed-off-by: Augustin Husson <[email protected]>
  • Loading branch information
Nexucis committed Apr 17, 2024
1 parent 946c8fa commit 6e49b06
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 9 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,15 @@ func (r *Runner) WithTaskHelpers(t ...taskhelper.Helper) *Runner {
return r
}

func (r *Runner) WithDefaultHTTPServer(metricNamespace string, registerer prometheus.Registerer) *Runner {
func (r *Runner) WithDefaultHTTPServer(metricNamespace string) *Runner {
r.serverBuilder = echo.NewBuilder(addr).
APIRegistration(echo.NewMetricsAPI(true, prometheus.DefaultRegisterer)).
MetricNamespace(metricNamespace).
PrometheusRegisterer(prometheus.DefaultRegisterer)
return r
}

func (r *Runner) WithDefaultHTTPServerAndPrometheusRegistry(metricNamespace string, registerer prometheus.Registerer) *Runner {
r.serverBuilder = echo.NewBuilder(addr).
APIRegistration(echo.NewMetricsAPI(true, registerer)).
MetricNamespace(metricNamespace).
Expand Down
4 changes: 2 additions & 2 deletions echo/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ func (b *Builder) Middleware(mdw echo.MiddlewareFunc) *Builder {
return b
}

// OverrideDefaultMiddleware is setting a flag that will tell if the Builder needs to override the default list of middleware considered by the one provided by the method Middleware
// In case the flag is set at false, then the middleware provided by the user will be append to the default list.
// OverrideDefaultMiddleware is setting a flag that will tell if the Builder needs to override the default list of middleware considered by the one provided by the method Middleware.
// In case the flag is set at false, then the middleware provided by the user will be appended to the default list.
// Note that the default list is always executed at the beginning (a.k.a, the default middleware will be executed before yours).
func (b *Builder) OverrideDefaultMiddleware(override bool) *Builder {
b.overrideMiddleware = override
Expand Down

0 comments on commit 6e49b06

Please sign in to comment.