dotnet / dotnet/aspnetcore

Add endpoint name / action label to OpenTelemetry metrics

Open
#51,209 10 comments 0 reactions 0 assignees View on GitHub
area-networking
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

With dotnet 8 ramping up open telemetry adoption, I'm investigating migrating from Prometheus-net to the open telemetry Prometheus exporter. It'd be useful to make the migration from Prometheus-net as simple as possible, and ideally implement the same functionality where possible.

Other than labels being named differently (which is understandable), the main functionality missing appears to be the lack of the endpoint name as a label on `http_request_duration_seconds`. Prometheus-net has it as "action". It's really useful to have this as part of the metric to display directly in Grafana etc.

![20231008_084412](https://github.com/dotnet/aspnetcore/assets/557065/51131651-c89c-4ce4-bf19-0251494e1663)

### Describe the solution you'd like

Adding the endpoint name to the `http_request_duration_seconds` metrics would add significant value when reporting on these metrics in tools like Grafana.

It would also be useful if possible to rename & exclude default labels so that the metrics could be configured to match the metrics generated from the current Prometheus-net package (and reduce the size of metrics if some aren't required). I'm not sure if this is something that tag enrichment via the `IHttpMetricsTagsFeature` makes possible already.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.