Skip to content

Sentry creates separate otel context for dynamic pages when using @vercel/otel #12907

Closed

Description

@adam187

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.17.0

Framework Version

next latest

Link to Sentry event

No response

SDK Setup/Reproduction Example

https://github.com/adam187/nextjs-sentry-otel-example

Steps to Reproduce

  1. yarn install
  2. yarn build
  3. yarn start
  4. curl 'http://localhost:3000'

Expected Result

All otel spans should have same trace id for single request.

Actual Result

Sentry creates own isolated scope that cause having spans from single splitted into two separate traces.

image

This is problematic since you can't view full trace for a single request.

Activity

  1. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Jul 13, 2024
  2. adam187 commented on Jul 13, 2024

    @adam187
    ContributorAuthor

    Looks like it could be related to #11625

  3. lforst commented on Jul 15, 2024

    @lforst
    Contributor

    Hi, I am trying to better understand your desired outcome. What do traces look for you, and what would you like them to look like?

  4. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Jul 15, 2024
  5. adam187 commented on Jul 29, 2024

    @adam187
    ContributorAuthor

    Hi, I am trying to better understand your desired outcome. What do traces look for you, and what would you like them to look like?

    Sorry for late reply.

    The desired outcome would be to have all spans from single request assigned to same trace id.
    Now Sentry creates own context so all spans created by sentry and within sentry context are not assigned to original trace.

    For us it's problematic since we can't see full trace by original trace id.

  6. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Jul 29, 2024
  7. self-assigned this
    on Jul 29, 2024
  8. self-assigned this
    on Jul 29, 2024
  9. chargome commented on Jul 29, 2024

    @chargome
    Member

    Hi @adam187, I talked with @lforst and there are a few things to unpack:

  10. 22 remaining items

  11. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Oct 14, 2024
  12. lforst commented on Oct 14, 2024

    @lforst
    Contributor

    @csshsh we'll release an update to the SDK very soon that should address all of your concerns. Right now there is no workaround except for disabling @vercel/otel which btw also produces a lot of incorrect data. (see vercel/next.js#70908)

  13. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Oct 14, 2024
  14. csshsh commented on Oct 14, 2024

    @csshsh

    @csshsh we'll release an update to the SDK very soon that should address all of your concerns. Right now there is no workaround except for disabling @vercel/otel which btw also produces a lot of incorrect data. (see vercel/next.js#70908)

    Just to avoid misunderstandings, this update to the Sentry SDK will also allow configuring Sentry in a way so it does NOT escape from the next.js tracing?

  15. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Oct 14, 2024
  16. lforst commented on Oct 14, 2024

    @lforst
    Contributor

    @csshsh correct. We will very strongly depend on Next.js tracing moving forward - no escapages, except for situations where we find that Next.js spans are completely inaccurate. Note that pure Sentry users without any custom setups are a priority for us right now. Not because we don't care about the others, but because this stuff is surprisingly complex and we need to converge to a stable state step by step.

  17. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Oct 14, 2024
  18. lforst commented on Nov 6, 2024

    @lforst
    Contributor

    This should be solved with the latest version of the SDK. Let us know if it works. (Only exception being Next.js Pages router API routes because Next.js emits completely wrong durations for those)

  19. adam187 commented on Mar 12, 2025

    @adam187
    ContributorAuthor

    I finally had some time to upgrade Sentry again, looks like it's working now as expected now 🙇

  20. ghost added on Aug 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions