Skip to content

Commit 6e49b06

Browse files
committed
add a new method in the app that help to define the prom registry
Signed-off-by: Augustin Husson <[email protected]>
1 parent 946c8fa commit 6e49b06

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

app/app.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,15 @@ func (r *Runner) WithTaskHelpers(t ...taskhelper.Helper) *Runner {
168168
return r
169169
}
170170

171-
func (r *Runner) WithDefaultHTTPServer(metricNamespace string, registerer prometheus.Registerer) *Runner {
171+
func (r *Runner) WithDefaultHTTPServer(metricNamespace string) *Runner {
172+
r.serverBuilder = echo.NewBuilder(addr).
173+
APIRegistration(echo.NewMetricsAPI(true, prometheus.DefaultRegisterer)).
174+
MetricNamespace(metricNamespace).
175+
PrometheusRegisterer(prometheus.DefaultRegisterer)
176+
return r
177+
}
178+
179+
func (r *Runner) WithDefaultHTTPServerAndPrometheusRegistry(metricNamespace string, registerer prometheus.Registerer) *Runner {
172180
r.serverBuilder = echo.NewBuilder(addr).
173181
APIRegistration(echo.NewMetricsAPI(true, registerer)).
174182
MetricNamespace(metricNamespace).

echo/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ func (b *Builder) Middleware(mdw echo.MiddlewareFunc) *Builder {
104104
return b
105105
}
106106

107-
// 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
108-
// In case the flag is set at false, then the middleware provided by the user will be append to the default list.
107+
// 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.
108+
// In case the flag is set at false, then the middleware provided by the user will be appended to the default list.
109109
// Note that the default list is always executed at the beginning (a.k.a, the default middleware will be executed before yours).
110110
func (b *Builder) OverrideDefaultMiddleware(override bool) *Builder {
111111
b.overrideMiddleware = override

0 commit comments

Comments
 (0)