feat(remix): Update scope transactionName when resolving route#11420
Merged
feat(remix): Update scope transactionName when resolving route#11420
transactionName when resolving route#11420Conversation
Lms24
commented
Apr 4, 2024
Comment on lines
+162
to
+173
| if (matches && matches.length) { | ||
| const routeName = matches[matches.length - 1].id; | ||
| getCurrentScope().setTransactionName(routeName); | ||
|
|
||
| if (activeRootSpan && matches && matches.length) { | ||
| const transaction = getRootSpan(activeRootSpan); | ||
| const activeRootSpan = getActiveSpan(); | ||
| if (activeRootSpan) { | ||
| const transaction = getRootSpan(activeRootSpan); | ||
|
|
||
| if (transaction) { | ||
| transaction.updateName(matches[matches.length - 1].id); | ||
| transaction.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route'); | ||
| if (transaction) { | ||
| transaction.updateName(routeName); | ||
| transaction.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route'); | ||
| } |
Member
Author
There was a problem hiding this comment.
slightly refactored this part because we always want to update the scope's transaction name; not just if there's an active span
transactionName when resolving route
mydea
approved these changes
Apr 4, 2024
cadesalaberry
pushed a commit
to cadesalaberry/sentry-javascript
that referenced
this pull request
Apr 19, 2024
…sentry#11420) This PR updates the current scope's `transactionName` when our Remix router instrumentation resolves the parameterized route name.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
transactionNamewhen our Remix router instrumentation resolves the parameterized route name.ref: #10846