Skip to content

Commit

Permalink
ref(remix): Extract propagation context in request handler (#8427)
Browse files Browse the repository at this point in the history
  • Loading branch information
AbhiPrasad authored Jun 30, 2023
1 parent 08ddcfb commit f8e07ef
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/remix/src/utils/instrumentServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ import { captureException, getCurrentHub } from '@sentry/node';
import type { Transaction, TransactionSource, WrappedFunction } from '@sentry/types';
import {
addExceptionMechanism,
baggageHeaderToDynamicSamplingContext,
dynamicSamplingContextToSentryBaggageHeader,
extractTraceparentData,
fill,
isNodeEnv,
loadModule,
logger,
tracingContextFromHeaders,
} from '@sentry/utils';

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

const transaction = hub.startTransaction({
name,
Expand Down

0 comments on commit f8e07ef

Please sign in to comment.