-
Notifications
You must be signed in to change notification settings - Fork 302
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
[Instrumentation.AspNet] Fix multiple routes of same template in attribute-based routing #2250
[Instrumentation.AspNet] Fix multiple routes of same template in attribute-based routing #2250
Conversation
Please sign EasyCLA. It is hard requirement to accept any contribution to this repository. |
Thanks. Working with my company to figure this out. |
|
Okay, I finally got my company to sign the CLA. Please proceed with reviewing! |
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add an entry to the Changelog
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update the PR title to start with [Instrumentation.AspNet]
test/OpenTelemetry.Instrumentation.AspNet.Tests/RouteTestHelper.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Rasmus Kuusmann <[email protected]>
Co-authored-by: Yevhenii Solomchenko <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2250 +/- ##
==========================================
+ Coverage 73.91% 76.73% +2.81%
==========================================
Files 267 15 -252
Lines 9615 361 -9254
==========================================
- Hits 7107 277 -6830
+ Misses 2508 84 -2424
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tchowice. Thanks for your contribution. Merging.
Changes
ASP.NET instrumentation fails to extract route for attribute-based routing, if multiple HTTP methods use the same route template--a common scenario for RESTful APIs. For example:
In this case, the
MS_Subroutes
array will have multiple elements, each corresponding to a different HTTP method.The original code only extracts the route template if there's only one element in the array. The correct thing to do is to just extract the template from the first subroute, since all subroutes have the same template.
It's not possible for MS_Subroutes array to have different templates in its elements. WebAPI would fail to route and throw an exception, if you declare multiple actions for the same method/template
Merge requirement checklist
CHANGELOG.md
files updated for non-trivial changes