-
Notifications
You must be signed in to change notification settings - Fork 77
Open
Description
Hi @slok ,
When using http
directly I do see how to set a specific handlerID
for each route:
https://github.com/slok/go-http-metrics/blob/master/examples/custom/main.go#L54-L57
But in the chi
example there is none:
https://github.com/slok/go-http-metrics/blob/master/examples/chi/main.go
Since your library seems not able take as entry a HandleFunc
to return a HandleFunc
, I guess I have to manage it with a more complex way with chi
. Something like:
r := chi.NewRouter()
recorder := metrics.NewRecorder(metrics.Config{
Registry: reg,
Prefix: "exampleapp",
DurationBuckets: []float64{1, 2.5, 5, 10, 20, 40, 80, 160, 320, 640},
})
mdlw := middleware.New(middleware.Config{
Recorder: recorder,
GroupedStatus: true,
})
// Specific route
r.Group(func(r chi.Router) {
r.Use(std.HandlerProvider("my_specific_route", mdlw))
r.Post("/", aaaaaaa)
})
return r
Is there a more simple way than embedding all my registered routes with Post / Get / ...
inside individual groups?
Thank you,
Metadata
Metadata
Assignees
Labels
No labels