Conversation
|
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
54c0044 to
d3ab87a
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3338 +/- ##
==========================================
+ Coverage 68.61% 68.78% +0.17%
==========================================
Files 431 422 -9
Lines 16429 16410 -19
==========================================
+ Hits 11272 11287 +15
+ Misses 5157 5123 -34
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
I'll recheck http route tests readme and update the changelog. So after that, this change should be ready to go. |
# Conflicts: # src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md
| | :broken_heart: | ConventionalRouting | [Non-default action with query string](#metrics__conventionalrouting-non-default-action-with-query-string) | | ||
| | :green_heart: | ConventionalRouting | [Not Found (404)](#metrics__conventionalrouting-not-found-404) | | ||
| | :green_heart: | ConventionalRouting | [Route template with parameter constraint](#metrics__conventionalrouting-route-template-with-parameter-constraint) | | ||
| | :broken_heart: | ConventionalRouting | [Route template with parameter constraint](#metrics__conventionalrouting-route-template-with-parameter-constraint) | |
There was a problem hiding this comment.
There is some green_heart to broken_heart changes across all net targets. Is it intentional?
There was a problem hiding this comment.
yes, you can recheck some ideal route changes. It's caused because of the different ideal route (cleaned constraints, excess symbols like '/', removing optionals if not present, etc)
There was a problem hiding this comment.
We shouldn't introduce more broken_hearts. If you're making a behavior change that you think is correct then the test harness should be adjusted to produce a green_heart. The main thing these markdown files were meant to highlight is remaining gaps we should aim to get fixed.
For code that we do not control, my hope was that we could push on the ASP.NET team to consider making changes.
Also behavior must remain identical (even if the behavior is not ideal) between the attributes added to metrics and those added to spans. Is this still true with this PR?
There was a problem hiding this comment.
There is no way that hearts will remain the same, when the expectation was also wrong.
New expectations are in line with AspNet package, spec and consistent output.
There is also no way that spans and metrics can have identical behaviour. Since one part is what we control and another is uncontrollable. I don't know what is more ideal, either ASP.NET Core has to adapt faster or SDK apis are extended for packages around API to be able to override the src behaviour.
| "currentHttpRoute": null, | ||
| "expectedHttpRoute": "/MinimalApiUsingMapGroup/" | ||
| "currentMetricRoute": "/MinimalApiUsingMapGroup/", | ||
| "expectedHttpRoute": "MinimalApiUsingMapGroup" |
There was a problem hiding this comment.
There are 2 ways, either to include / always or not to include. The same route must not produce 2 different versions.
So if there is no extra meaning (and a need), then there is no point to include it. Same in ASP.NET MVC5.
| } | ||
| } | ||
|
|
||
| private static string GetRoutePattern(RoutePattern routePattern, RouteValueDictionary routeValues) |
There was a problem hiding this comment.
This always runs, right? Should it only run if the route needs to change? i.e. there are area/controller/action/page attributes and a value is present in the requests route values collection.
There was a problem hiding this comment.
Correct. It would be a nice optimization. Also connected to #3338 (comment) (so it runs only if the framework provides the values).
| "currentHttpRoute": null, | ||
| "expectedHttpRoute": "SomePath/{id}/{num:int}" | ||
| "currentMetricRoute": "SomePath/{id}/{num:int}", | ||
| "expectedHttpRoute": "SomePath/{id}/{num}" |
There was a problem hiding this comment.
The route constraint is being lost
There was a problem hiding this comment.
This is intentional change:
pros:
- produces similar routes as asp.net mvc5
- reduces cardinality
- simplifies the template
negs:
- no visibility into same routes but different constraints (possibly very rare case)
| "currentHttpRoute": null, | ||
| "expectedHttpRoute": "/MinimalApi/{id}" | ||
| "currentMetricRoute": "/MinimalApi/{id}", | ||
| "expectedHttpRoute": "MinimalApi/{id}" |
There was a problem hiding this comment.
What happens if a minimal api route has a parameter called action? Will it be rewritten? There is nothing stopping a minimal API having a parameter with that name and it isn't a static part of the route.
There was a problem hiding this comment.
currently yes, unless there is a framework marker so we can check if it was included by the framework.
This comment was marked as outdated.
This comment was marked as outdated.
|
My opinion about these topics:
That is already so broken and off the spec that I'm not sure which parts could be trusted for machine processing.
Since SDK is exporting them, then additional processor should be available for API users as well as SDK users already have that option.
Same as above. |
|
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
|
I’m away. I’ll reply next week |
|
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
|
I updated OTEL The PR to created improved routes is here: dotnet/aspnetcore#64854 I think the approach I used (using RequiredValues collection) is better. The rest of the route unchanged except the replaced parameter. And it doesn't rely on hardcoded parameter names, e.g. it won't try to replace a "controller" parameter in a minimal API route. |
|
I know the spec is quite weak about framework specifics in the I would personally hate to see "unnecessary paddings" like
Secondly those tokens should be present then also in the Activity DisplayName, which makes it even more, not making sense. Thirdly, those tokens can add cardinality is some cases. src: https://opentelemetry.io/docs/specs/semconv/http/http-spans/#name |
People will expect And things like constraints are important information. This is possible: var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.MapGet("/product/{id:alpha}", (string id) => "alpha");
app.MapGet("/product/{id:int}", (string id) => "int");
app.Run();Stripping the constraint would make the matched route ambigious.
Constraints are important information. And optional parameters are part of the route, even if they're not matched. Even if we wanted to optionally add optional parameters to the route string, it would mean a performance cost because it couldn't be statically determined. The change I made to ASP.NET Core means that the final route template is generated when the endpoint is created. There is no per-request overhead. |
|
This basically means that spec must separate HTTP span name from including |
|
@RassK Should we close this PR? It's been open for over 6 months with zero forward progress. |
Yes, I can update it if there is any progress. So far seems it's stuck in spec and even if there is going to be any progress, then most probably it needs native support to avoid doing performance hitting work in hot paths. |
Follow up to #3160
Changes
Normalizes route template according to spec.
Merge requirement checklist
CHANGELOG.mdfiles updated for non-trivial changes