do not lose span renames when the rename happens before returning actions in a play controller #1412
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This should fix #1411.
The root of the issue is that in some Play applications there could be controllers that look a bit like this:
In these cases the rename happens during the "routing" part of the request handling in Play (see here and we apply the default operation names after that, during the filter handling which effectively overrides any operation name that was set during the routing stage.
It's hard to protect against unusual usage patterns like this (usually all processing would happen inside an Action) but regardless of what's causing the issue we should not overwrite operation names assigned by users. This PR just checks whether the operation name is the default and if so, it generates a new name. We do something similar in the Akka HTTP routing instrumentation as well.
I don't like that we are not reading the default operation name from config but for now I think we can live with that.