Skip to content

feat(remix): Update scope transactionName when resolving route #11420

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

Merged
merged 1 commit into from
Apr 4, 2024

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Apr 4, 2024

This PR updates the current scope's transactionName when our Remix router instrumentation resolves the parameterized route name.

ref: #10846

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');
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

slightly refactored this part because we always want to update the scope's transaction name; not just if there's an active span

@Lms24 Lms24 self-assigned this Apr 4, 2024
@Lms24 Lms24 requested review from onurtemizkan, mydea and s1gr1d April 4, 2024 08:35
@Lms24 Lms24 changed the title feat(remix): Update scope transactionName when resolving route feat(remix): Update scope transactionName when resolving route Apr 4, 2024
@Lms24 Lms24 merged commit b1a2f8b into develop Apr 4, 2024
@Lms24 Lms24 deleted the lms/feat-remix-update-scope-transactionName branch April 4, 2024 09:37
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants