Skip to content

Sentry span not keep traceId #14803

Closed
Closed
@xiaoxiangmoe

Description

@xiaoxiangmoe

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/node

SDK Version

8.43.0

Framework Version

nodejs

Link to Sentry event

No response

Reproduction Example/SDK Setup

No response

Steps to Reproduce

import * as _crypto from 'node:crypto';
import * as Sentry from '@sentry/node';

// Simulates the traceId obtained from the outside world
function getRandomSentryTraceData() {
    const sentryTrace = _crypto.randomBytes(16).toString('hex') + '-' + _crypto.randomBytes(8).toString('hex');
    console.log('traceId', sentryTrace);
    return { sentryTrace, baggage: 'environment=dev' };
}

const main = () =>
    Sentry.continueTrace(getRandomSentryTraceData(), async () => {
      await Sentry.startSpan({ name: 'hello span' }, (span) => {
          console.log('span traceId', span.spanContext().traceId);
      })
  })

main()

Expected Result

Log same traceId

same as v8.42.0

Actual Result

different traceId

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: nodeIssues related to the Sentry Node SDK

    Type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions