-
Notifications
You must be signed in to change notification settings - Fork 773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing route pattern in requests that do not reach the MVC middleware #3461
Comments
@cijothomas please let me know if this belongs in a separate issue, but I've found a somewhat related issue where the route pattern is missing when the action uses conventional routing. This can be repro'ed by extending the provided repo with the following code changes:
app.UseEndpoints(e =>
{
e.MapControllers();
e.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});
When the new action is reached by sending a request to
If the proposed solution is adopted, then the display name and the http.route would be populated with the pattern |
@vishweshbankwar FYI |
Not sure if I should log a seperate issue but I have a related problem. The http.route is populate when the request is successful. The http.route is missing on 500s |
"http.route" field is filled when the request is successful and returns a status code of 200, but it is not filled in when the status code is 400 inside a request. I use the Latest prerelease 1.5.0-rc.1. |
I don't use What I am able to do, is store my route patterns in |
@HamidEbr #5134 should fix this. As a temporary workaround you can manually add the tag using the enrich method: .AddAspNetCoreInstrumentation(opts =>
{
opts.Enrich = (string _, HttpContext context, ref TagList tags) =>
{
...
var route = (exceptionHandlerFeature.Endpoint as RouteEndpoint)?.RoutePattern.RawText;
};
}) |
Hi, i have a similar issue with AspNetInstrumentation (not core). All the traces are turning up like {controller}/{action}/{id} in the new relic where we are sending the data for now. I have been going through the documentation to find any solution. any pointers to as how it can be implemented. |
Bug Report
OpenTelemetry NuGet packages:
Runtime version:
net6.0
Symptom
When MVC requests get stopped by previous middlewares (e.g. authentication), the
Microsoft.AspNetCore.Mvc.BeforeAction
event isn't sent and so theActivity
isn't properly renamed with the route pattern and thehttp.route
tag isn't added.This is a problem since we can't easily identify requests that belong to the same operation due to various failures in middlewares.
In addition, requests that do not use MVC don't have the route set either.
What is the expected behavior?
The activity name and
http.route
tag should be equal to the route pattern.Suggestion for a solution - Instead of relying on
Mvc.BeforeAction
useMicrosoft.AspNetCore.Routing.EndpointMatched
, which would also work outside of MVC. Then get the route pattern using:What is the actual behavior?
The activity name equals the full URI path and
http.route
is empty.Reproduce
otel-missing-route.zip
Calling those 2 endpoints (while unauthenticated) produces:
and
The text was updated successfully, but these errors were encountered: