MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / _getTraceInfoFromScope

Function _getTraceInfoFromScope

packages/core/src/utils/trace-info.ts:13–29  ·  view source on GitHub ↗
(
  client: Client,
  scope: Scope | undefined,
)

Source from the content-addressed store, hash-verified

11
12/** Extract trace information from scope */
13export function _getTraceInfoFromScope(
14 client: Client,
15 scope: Scope | undefined,
16): [dynamicSamplingContext: Partial<DynamicSamplingContext> | undefined, traceContext: TraceContext | undefined] {
17 if (!scope) {
18 return [undefined, undefined];
19 }
20
21 return withScope(scope, () => {
22 const span = getActiveSpan();
23 const traceContext = span ? spanToTraceContext(span) : getTraceContextFromScope(scope);
24 const dynamicSamplingContext = span
25 ? getDynamicSamplingContextFromSpan(span)
26 : getDynamicSamplingContextFromScope(client, scope);
27 return [dynamicSamplingContext, traceContext];
28 });
29}

Callers 3

captureCheckInMethod · 0.90
_INTERNAL_captureLogFunction · 0.90
_buildSerializedMetricFunction · 0.90

Calls 6

withScopeFunction · 0.90
getActiveSpanFunction · 0.90
spanToTraceContextFunction · 0.90
getTraceContextFromScopeFunction · 0.90

Tested by

no test coverage detected