Skip to content

Commit f8e07ef

Browse files
authored
ref(remix): Extract propagation context in request handler (#8427)
1 parent 08ddcfb commit f8e07ef

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

packages/remix/src/utils/instrumentServer.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@ import { captureException, getCurrentHub } from '@sentry/node';
55
import type { Transaction, TransactionSource, WrappedFunction } from '@sentry/types';
66
import {
77
addExceptionMechanism,
8-
baggageHeaderToDynamicSamplingContext,
98
dynamicSamplingContextToSentryBaggageHeader,
10-
extractTraceparentData,
119
fill,
1210
isNodeEnv,
1311
loadModule,
1412
logger,
13+
tracingContextFromHeaders,
1514
} from '@sentry/utils';
1615

1716
import type {
@@ -290,9 +289,11 @@ export function startRequestHandlerTransaction(
290289
method: string;
291290
},
292291
): Transaction {
293-
// If there is a trace header set, we extract the data from it (parentSpanId, traceId, and sampling decision)
294-
const traceparentData = extractTraceparentData(request.headers['sentry-trace']);
295-
const dynamicSamplingContext = baggageHeaderToDynamicSamplingContext(request.headers.baggage);
292+
const { traceparentData, dynamicSamplingContext, propagationContext } = tracingContextFromHeaders(
293+
request.headers['sentry-trace'],
294+
request.headers.baggage,
295+
);
296+
hub.getScope().setPropagationContext(propagationContext);
296297

297298
const transaction = hub.startTransaction({
298299
name,

0 commit comments

Comments
 (0)