-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Routing] always add _route_path
as request attribute
#47970
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
Conversation
Hey! I see that this is your first PR. That is great! Welcome! Symfony has a contribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
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.
Hello @cdaguerre. Thanks opening this PR while you explore alternative solutions.
Major APM (datadog, newrelic and instana) use the route name to name the span. This keep distinction between routes with the same path pattern but distinct host/condition/requirements...
That is indeed one of the alternatives. However, it is not really compliant with OpenTelemetry's semantic conventions... |
_path
as request attribute
src/Symfony/Component/Routing/Matcher/Dumper/CompiledUrlMatcherDumper.php
Outdated
Show resolved
Hide resolved
_path
as request attribute_route_path
as request attribute
I made the changes you requested and fixed the tests. |
I can see that having the route path available might be useful. But it seems arbitrary to me that the returned values include the route path but none of the other route information like route host, scheme etc. |
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.
Same opinion. Getting raw route config from the requests is only a partial solution for your need.
There is a risk that these values will be misused to generate urls.
Hi @cdaguerre, I closed your MR because we think this informations should not be exposed as this. I see you found an alternative in worldia/instrumentation-bundle#12 that is good and allows more specific code. |
alright, thanks |
This PR adds the
_path
attribute to attributes returned by the request matcher.If I'm not mistaken, this information is actually hard to get without using the
RouteCollection
at runtime or manipulating cache files directly (be they generated by the routing cache warmer or by a custom cache warmer).I'b be glad to add/fix tests if there is an agreement on the principle ;)