Skip to content

Commit 5f7a0fb

Browse files
authored
fix(node): Set propagation context even when tracingOptions are not defined (#8517)
1 parent 6be123e commit 5f7a0fb

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

packages/node/src/handlers.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,6 @@ export function tracingHandler(): (
5353
return next();
5454
}
5555

56-
if (!hasTracingEnabled(options)) {
57-
__DEBUG_BUILD__ &&
58-
logger.warn(
59-
'Sentry `tracingHandler` is being used, but tracing is disabled. Please enable tracing by setting ' +
60-
'either `tracesSampleRate` or `tracesSampler` in your `Sentry.init()` options.',
61-
);
62-
return next();
63-
}
64-
6556
const sentryTrace = req.headers && isString(req.headers['sentry-trace']) ? req.headers['sentry-trace'] : undefined;
6657
const baggage = req.headers?.baggage;
6758
const { traceparentData, dynamicSamplingContext, propagationContext } = tracingContextFromHeaders(
@@ -70,6 +61,10 @@ export function tracingHandler(): (
7061
);
7162
hub.getScope().setPropagationContext(propagationContext);
7263

64+
if (!hasTracingEnabled(options)) {
65+
return next();
66+
}
67+
7368
const [name, source] = extractPathForTransaction(req, { path: true, method: true });
7469
const transaction = startTransaction(
7570
{

0 commit comments

Comments
 (0)