-
-
Couldn't load subscription status.
- Fork 1.7k
feat(koa): Update scope transactionName when creating router span
#11476
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
| instrumentations: [ | ||
| new KoaInstrumentation({ | ||
| requestHook(span, info) { | ||
| if (span.isRecording() && info.layerType === 'router') { |
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.
l: do we need this check? Can we not just directly check if the HTTP_ROUTE attribute exist, and if so use it?
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.
I guess we can 🤔 I wanted to play it safe. q: is it safe to call spanToJSON on a non-recording span?
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.
yes, it will just return {} then, basically!
4a3c92f to
7cdd7f4
Compare
size-limit report 📦
|
…etsentry#11476) Update 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/via `app.use` because similarly to Express, koa doesn't seem to expose this information before going through the actual route layers.
This PR updates the current scope's
transactionNamein our Koa integration. Unfortunately, I didn't find a reliable way to get the parameterized route in our error handler/viaapp.usebecause 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 privatectxvariable but in my testing this didn't work. Seems like there are multiple versions ofkoa-router/@koa/routerwhere 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