sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

Traces no longer encapsulates multiple spans

Open MitP1997 opened this issue 1 month ago • 2 comments

Is there an existing issue for this?

  • [x] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
  • [x] I have reviewed the documentation https://docs.sentry.io/
  • [x] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/cloudflare - hono

SDK Version

10.28.0

Framework Version

No response

Link to Sentry event

No response

Reproduction Example/SDK Setup

I have my hono app wrapped within Sentry.withSentry with tracesSampleRate set to 1. I also have the below code in the handler wrapped inside withSentry

    const sentryTrace = request.headers.get('sentry-trace') ?? undefined;
    const baggage = request.headers.get('baggage') ?? undefined;

    return Sentry.continueTrace({ sentryTrace, baggage }, async () => {
      // All spans created inside here should use the incoming trace context
      const response = (await app!.fetch(
        request as unknown as Request,
        env,
        ctx,
      )) as unknown as CloudflareResponse;
      return response;
    });

Steps to Reproduce

  1. Setup hono app using withSentry
  2. Setup continueTrace using the headers baggage and sentry-trace forwarded by the client
  3. Attempt a request from client to hono backend deployed on cloudflare

Expected Result

Expecting a distributed trace that shows the entire timeline from client to backend and back.

Actual Result

Earlier on 10.11.0, I had withSentry without continueTrace. While enabling distributed tracing using continueTrace, found this issue. Thus, installed the latest version 10.28.0 which has a fix for it.

Check the below screenshot

  1. Highlighted in green box is tracing on 10.11.0 without continueTrace
  2. Highlighted in red box is tracing on 10.28.0 with continueTrace, which splits up the trace into multiple 1 for every span.
Image

Additional Context

No response

Priority

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.

MitP1997 avatar Dec 04 '25 08:12 MitP1997

JS-1252

linear[bot] avatar Dec 04 '25 08:12 linear[bot]

@MitP1997 Our SDKs usually continue the trace automatically.

Can you confirm that you get the actual values in:

const sentryTrace = request.headers.get('sentry-trace') ?? undefined;
const baggage = request.headers.get('baggage') ?? undefined;

chargome avatar Dec 04 '25 09:12 chargome