-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Description
Currently, metrics are exposed as:
http_request_duration_microseconds{handler="users",quantile="0.5"} 401.237
...
http_request_duration_microseconds{handler="users",quantile="0.5"} 652.793
...
http_request_duration_microseconds{handler="users",quantile="0.5"} 652.793
I would like to add on to this by also allowing for a path
label to be added so that each route does not need to be manually instrumented with a handler name. I'm proposing that the default collection should result in:
http_request_duration_microseconds{handler="users",path="/users/logout",quantile="0.5"} 401.237
...
http_request_duration_microseconds{handler="users",path="/users/login",quantile="0.5"} 652.793
...
http_request_duration_microseconds{handler="users",path="/users/status",quantile="0.5"} 652.793
...
# other examples I think would be useful
http_requests_total{code="200",handler="users",path="/users/status",method="get"} 3
promhttp_metric_handler_requests_total{path="/some/other/endpoint",code="200"} 2
promhttp_metric_handler_requests_total{path="/another/endpoint",code="500"} 0
promhttp_metric_handler_requests_total{path="/yet/another/endpoint",code="503"} 0
This could be done by adding r.URL.Path
to the labels creation as a path
label.
I'm new to Golang but would be happy to attempt this with some guidance!
Any opinions?