Skip to content

Commit 4693a71

Browse files
committed
update node env to use helper func
1 parent 7975864 commit 4693a71

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

packages/node/src/sdk.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
logger,
1616
nodeStackLineParser,
1717
stackParserFromStackParserOptions,
18+
tracingContextFromHeaders,
1819
uuid4,
1920
} from '@sentry/utils';
2021

@@ -301,21 +302,9 @@ function startSessionTracking(): void {
301302
function updateScopeFromEnvVariables(): void {
302303
const sentryUseEnvironment = (process.env.SENTRY_USE_ENVIRONMENT || '').toLowerCase();
303304
if (!['false', 'n', 'no', 'off', '0'].includes(sentryUseEnvironment)) {
304-
const sentryTraceEnv = process.env.SENTRY_TRACE || '';
305+
const sentryTraceEnv = process.env.SENTRY_TRACE;
305306
const baggageEnv = process.env.SENTRY_BAGGAGE;
306-
307-
const traceparentData = extractTraceparentData(sentryTraceEnv) || {};
308-
const { traceId, parentSpanId, parentSampled } = traceparentData;
309-
const propagationContext: PropagationContext = {
310-
traceId: traceId || uuid4(),
311-
spanId: uuid4().substring(16),
312-
parentSpanId,
313-
sampled: parentSampled === undefined ? false : parentSampled,
314-
};
315-
const dynamicSamplingContext = baggageHeaderToDynamicSamplingContext(baggageEnv);
316-
if (dynamicSamplingContext) {
317-
propagationContext.dsc = dynamicSamplingContext as DynamicSamplingContext;
318-
}
307+
const { propagationContext } = tracingContextFromHeaders(sentryTraceEnv, baggageEnv);
319308
getCurrentHub().getScope().setPropagationContext(propagationContext);
320309
}
321310
}

0 commit comments

Comments
 (0)