feat(koa): Update scope transactionName
when creating router span
#11476
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 PR updates the current scope's
transactionName
in our Koa integration. Unfortunately, I didn't find a reliable way to get the parameterized route in our error handler/viaapp.use
because similarly to Express, koa doesn't seem to expose this information before going through the actual route layers. A couple of stackoverflow posts suggest a way if potentially obtaining a routename via a privatectx
variable but in my testing this didn't work. Seems like there are multiple versions ofkoa-router
/@koa/router
where some support this and others don't...Consequence: In case of a negative sampling decision for the span, we can't update the scope's transaction name which most likely will be the unparameterized route set by our Http integration.
ref #10846