Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[feature request] AspNetCore - Support for IRoutingFeature in ASP.NET Core Instrumentation to Set http.route Tag #2565

Open
RohitRanjanMS opened this issue Feb 14, 2025 · 2 comments
Labels
comp:instrumentation.aspnetcore Things related to OpenTelemetry.Instrumentation.AspNetCore enhancement New feature or request

Comments

@RohitRanjanMS
Copy link

RohitRanjanMS commented Feb 14, 2025

Component

OpenTelemetry.Instrumentation.AspNetCore

Is your feature request related to a problem?

In our ASP.NET Core middleware in Azure Functions, we currently rely on IRoutingFeature to access routing information. However, we have encountered an issue with ASP.NET Core Instrumentation where the http.route tag is not being set as expected. This happens because the instrumentation framework depends on RouteEndpoint to retrieve the route pattern.
As a result, the display name for the telemetry only includes the HTTP verb (e.g., GET, POST) instead of the full route template. This leads to incomplete and less useful telemetry data.

What is the expected behavior?

The http.route tag should be populated correctly, even when IRoutingFeature is used.

Which alternative solutions or features have you considered?

Retrieve the routing information from IRoutingFeature and update the route and display name after the activity has been created.

Additional context

We recognize that RouteEndpoint is the preferred approach, but providing backward compatibility with IRoutingFeature would help maintain compatibility for applications that have not yet migrated.

@RohitRanjanMS RohitRanjanMS added the enhancement New feature or request label Feb 14, 2025
@github-actions github-actions bot added the comp:instrumentation.aspnetcore Things related to OpenTelemetry.Instrumentation.AspNetCore label Feb 14, 2025
@RohitRanjanMS
Copy link
Author

Hi @alanwest , do you have any suggestion on this?

@TimothyMothra
Copy link
Contributor

Hi @RohitRanjanMS, could you please share a minimal repro app that's showing what is/isn't happening?
I'm not familiar with IRoutingFeature and having something concrete to review would help us drive this conversation.
Thanks,

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
comp:instrumentation.aspnetcore Things related to OpenTelemetry.Instrumentation.AspNetCore enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants