There are some closed issues for exposing a request path (
#491 and
#520). The previous attempts to expose the label were rejected as we were concerned that it's easy to create cardinality explosions.
If we can expose the path label it will be beneficial in some use cases. Suppose we want to track a combination of method, path, and status code. At the moment, we must use a separate "http.Client" for each path with the curried metric vector with the path label. But by using the context, we can use a simpler approach. As shown in the following
pull request, we can do it simply. See the following example:
```
ctx := WithRequestPath(context.Background(), "/v1/get-tickets")
req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
if err != nil {
log.Printf("error: %v", err)
}
resp, err := client.Do(req)
```
I provide a proof of concept in the following pull request. please don't hesitate to take a look.
Thanks.