Skip to content

Unexpected amount of spans after upgrading to @sentry/nuxt to 9.8 #16039

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

Open
3 tasks done
dalnoki opened this issue Apr 14, 2025 · 14 comments
Open
3 tasks done

Unexpected amount of spans after upgrading to @sentry/nuxt to 9.8 #16039

dalnoki opened this issue Apr 14, 2025 · 14 comments

Comments

@dalnoki
Copy link

dalnoki commented Apr 14, 2025

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/browser

SDK Version

9.8 (now 9.12)

Framework Version

No response

Link to Sentry event

No response

Reproduction Example/SDK Setup

see additional details in the JIRA ticket

Steps to Reproduce

After upgrading @sentry/nuxt from 9.5 to 9.8 on March 26, 2025 at 1:54 PM, the customer noticed a large spike in spans reported to Sentry, despite having no changes to their tracesSampleRate (which is set to 0.001). Reviewing the changelog didn’t reveal any obvious reasons for this increase.

They deployed the update on 3/26/2025 at 1:54 PM. Since then, they upgraded to the latest version 4/9/2025, 2:38 PM UTC and they haven’t seen any changes in the stats in Sentry (they did disable Sentry from our production application though, so that’s the reason for the drop of events in the end of the graph.)

Expected Result

The incoming span count should have stayed roughly the same after the upgrade

Actual Result

The incoming span count increased

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Apr 14, 2025
@github-actions github-actions bot added the Package: browser Issues related to the Sentry Browser SDK label Apr 14, 2025
@mydea mydea removed the Package: browser Issues related to the Sentry Browser SDK label Apr 14, 2025
@mydea mydea added the Nuxt label Apr 14, 2025 — with Linear
@mydea mydea added the Package: nuxt Issues related to the Sentry Nuxt SDK label Apr 14, 2025 — with Linear
@mydea mydea removed the Nuxt label Apr 14, 2025
@mydea mydea added the Bug label Apr 14, 2025 — with Linear
@s1gr1d
Copy link
Member

s1gr1d commented Apr 14, 2025

Hello, were any changes made to routeRules? https://nuxt.com/docs/guide/concepts/rendering#hybrid-rendering

It seems like the HTML is cached (by setting swr or isr) and the Sentry tracing tags are kept the same all the time.

@Maaak9
Copy link

Maaak9 commented Apr 14, 2025

Hello, were any changes made to routeRules? https://nuxt.com/docs/guide/concepts/rendering#hybrid-rendering

It seems like the HTML is cached (by setting swr or isr) and the Sentry tracing tags are kept the same all the time.

Hey! We haven't made any changes to the routeRules.

Where can i find the Sentry tracing tags? Are you referring to the "sentry-trace" & "baggage" in the initial html that you think is cached?

@s1gr1d
Copy link
Member

s1gr1d commented Apr 14, 2025

Yes, the meta tags. Are the IDs staying the same over page-reloads? They should change.

@Maaak9
Copy link

Maaak9 commented Apr 14, 2025

I'm testing out on our QA environment atm and it seems like we have the same issue their. The ids in the meta tags are changing on page-reloads.

Searching for sentry in the network tag i always se two request to ingest.us.sentry.io

Image
Image

I should be seeing the sample rate here right?

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Apr 14, 2025
@s1gr1d
Copy link
Member

s1gr1d commented Apr 14, 2025

It's okay to have those two requests. One is a session and one is a transaction. However, you're right that the transaction does not include the sample_rate which I cannot reproduce right now.

Can you try downgrading the SDK again (you said it was fine at 9.5) and see whether the sample_rate is included here. I just want to make sure if this is the right track. Either it's something different that was changed during those versions or it's not even related to the version 🤔

And can you please share the debug logs from the server (if possible) and from the browser?

@Maaak9
Copy link

Maaak9 commented Apr 14, 2025

I added our master branch (with @sentry/nuxt: 9.12.0) to another environment with an identical setup (env variables, etc.).

Interestingly, the sample_rate is respected there. I'm currently investigating what differences might exist between the two environments. Based on this, it seems unlikely that the issue is related to the version of @sentry/nuxt.

If you have any ideas on what I could check, it would be very much appreciated!

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Apr 14, 2025
@s1gr1d
Copy link
Member

s1gr1d commented Apr 14, 2025

Hm...so as it's probably not only related to the sample_rate not being there (it's maybe just a symptom), it could also be anything cache-related. Maybe check if your backend automatically stores generated HTML pages for some time.

And in general: Can you maybe share the debug logs (frontend & backend) of an event that is correct in Sentry and one event that is not? The logs would give me more insights into what the SDK is doing under the hood. Thank you 🙏

@Maaak9
Copy link

Maaak9 commented Apr 15, 2025

We're currently not using any caching on the server where we're experiencing the issue.

After some investigation, we’ve identified that the only difference between the two environments is that sourceMapsUploadOptions is enabled in the one where things aren't working as expected.

Here’s the relevant section from our nuxt.config.js:

sourcemap: {
  client: 'hidden',
  server: true,
},
sentry: {
  debug: true,
  sourceMapsUploadOptions: {
    org: '*******',
    project: '*******',
    authToken: process.env.SENTRY_AUTH_TOKEN,
    enabled: process.env.SENTRY_AUTH_TOKEN != null,
  },
},

When we disable source maps, everything seems to work correctly with the configured sample rate.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Apr 15, 2025
@s1gr1d
Copy link
Member

s1gr1d commented Apr 15, 2025

Ah thank you, this is very helpful! We released some changes regarding source maps, but those actually seemed unrelated to this. I would have to check why this messes with the sampling but this is the suspected PR: #15859

This was released with 9.11.0, which means it should still work fine with 9.10.1. Can you try those two versions? Just to verify that it's really happening with the 9.11 update which includes the source maps changes.

@s1gr1d
Copy link
Member

s1gr1d commented Apr 15, 2025

So far I was not able to reproduce it. How does your setup look like?

  • Are you using any Nuxt routeRules in the nuxt.config.ts?
  • Is SSR disabled in Nuxt or are you using Nuxt as SPA?
  • How are you connecting the .NET and Nuxt traces?
  • Does the .NET server cache responses automatically?

@Maaak9
Copy link

Maaak9 commented Apr 16, 2025

  • We don’t have any routeRules.
  • We’re using Hybrid Rendering.
  • We don’t have any connection to .NET.

What we've noticed is that when sourceMapsUploadOptions is enabled and Sentry is also enabled on the server, a baggage meta tag is generatet, but it’s missing the sample_rate. This seems to affect the client-side Sentry, where the missing sample_rate causes all spans to be tracked.

We ended up removing our sentry.server.config.ts since we're mostly focused on tracking client-side errors anyway.

@getsantry getsantry bot moved this from Waiting for: Community to Waiting for: Product Owner in GitHub Issues with 👀 3 Apr 16, 2025
@s1gr1d
Copy link
Member

s1gr1d commented Apr 16, 2025

Maybe it's easier if we just have a short chat about this. Please send me an e-mail, so we can schedule something. It's my first and last name (connected with a dot) @sentry.io. Please send me a few time suggestions :)


We don’t have any routeRules. We’re using Hybrid Rendering.

Hybrid Rendering is enabled when defining routeRules - so I am a bit confused with your answer

We don’t have any connection to .NET

While I was looking through the traces I saw that there are a lot of connected traces which include requests to a .NET backend. So somehow the traces between this backend and the frontend must be linked 🤔

@stephanie-anderson stephanie-anderson added the Nuxt label Apr 16, 2025 — with Linear
@stephanie-anderson stephanie-anderson removed the Package: nuxt Issues related to the Sentry Nuxt SDK label Apr 16, 2025
@Maaak9
Copy link

Maaak9 commented Apr 17, 2025

I'll send you an email with some suggestions.

Hybrid Rendering is enabled when defining routeRules - so I am a bit confused with your answer

I'm sorry, I thought it was called hybrid rendering. Had to look it up on, and we are using Universal Rendering

While I was looking through the traces I saw that there are a lot of connected traces which include requests to a .NET backend. So somehow the traces between this backend and the frontend must be linked 🤔

We do have requests going from nuxt (server / client side) to a .NET backend. Maybe i misinterpreted your question earlier, but I thought you meant if we had sentry configured in our .NET backend.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Apr 17, 2025
@s1gr1d
Copy link
Member

s1gr1d commented Apr 17, 2025

Thanks for clarifications. Let's discuss this further in the call.

s1gr1d added a commit that referenced this issue Apr 17, 2025
Logging the tracing meta tags makes debugging [things like
this](#16039)
easier.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

5 participants