Skip to content
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

Custom tags not added to Perfromance Issues #15833

Open
3 tasks done
landenai opened this issue Mar 26, 2025 · 6 comments
Open
3 tasks done

Custom tags not added to Perfromance Issues #15833

landenai opened this issue Mar 26, 2025 · 6 comments
Labels
Package: nextjs Issues related to the Sentry Nextjs SDK

Comments

@landenai
Copy link

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nextjs

SDK Version

8.37.1

Framework Version

Next 15.0.1

Link to Sentry event

https://demo.sentry.io/issues/6396022267/?project=4508968158429184&query=&referrer=issue-stream&sort=date&stream_index=0

Reproduction Example/SDK Setup

I add a custom tag within a server action before a query is made that triggers a performance issue. When testing locally, I see the tag on the perfromance issue in Sentry. When testing on my vercel deployment, I do not see the tag. Here is how I add the tag

Image

Note: Ive already added console log statements and seen that se has a value.

Steps to Reproduce

  1. Add tag to current scope before query that triggers an N + 1 perfromance issue is made
  2. Trigger issue in Vercel, observe in Sentry

Expected Result

Tag is observable on performance issue in Sentry

Actual Result

Tag is not added to performance issue in Sentry

@github-actions github-actions bot added the Package: nextjs Issues related to the Sentry Nextjs SDK label Mar 26, 2025
@AbhiPrasad
Copy link
Member

AbhiPrasad commented Mar 26, 2025

Hey @landenai - if you capture an error, do you get the custom tag applied?

Could you also try running Sentry.setTag directly?

@landenai
Copy link
Author

Yes, different function but same server action. We capture an error and can see the tag in Sentry. I just tried Sentry.setTag with the same result

@lforst
Copy link
Member

lforst commented Mar 27, 2025

Performance events are created on the server from transactions (and spans) and transactions don't have tags so I think this is moot (?).

@landenai
Copy link
Author

Are we not suppose to be able to add tags to perfromance events? I've seen performance events with tags successfully added but maybe this wasn't intended functionality

@AbhiPrasad
Copy link
Member

Transactions do have tags, and the performance issue should be inheriting from the transaction. The fact that it works locally but not on vercel is the red flag for me.

I suspect what is happening is that on Vercel when we finish the transaction we aren’t in the right context anymore (outside of request) so we grab stuff from the wrong scope. Therefore the setTag call no longer applies.

@landenai One thing you could do to double check this is to do Sentry.getIsolationScope().setTag

@landenai
Copy link
Author

landenai commented Mar 31, 2025

@AbhiPrasad Sorry for the delay here, just tested getIsoloationScope and same result as expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: nextjs Issues related to the Sentry Nextjs SDK
Projects
Status: No status
Development

No branches or pull requests

3 participants