Skip to content

Commit b3988f5

Browse files
committed
better comments & small ref
1 parent 9cc0b7b commit b3988f5

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

packages/core/src/currentScopes.ts

+2-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Scope, TraceContext } from '@sentry/types';
22
import type { Client } from '@sentry/types';
3-
import { dropUndefinedKeys, generateSentryTraceHeader, getGlobalSingleton } from '@sentry/utils';
3+
import { dropUndefinedKeys, getGlobalSingleton } from '@sentry/utils';
44
import { getAsyncContextStrategy } from './asyncContext';
55
import { getMainCarrier } from './carrier';
66
import { Scope as ScopeClass } from './scope';
@@ -122,7 +122,7 @@ export function getClient<C extends Client>(): C | undefined {
122122
}
123123

124124
/**
125-
* Get a trace context for the currently active scopes.
125+
* Get a trace context for the given scope.
126126
*/
127127
export function getTraceContextFromScope(scope: Scope): TraceContext {
128128
const propagationContext = scope.getPropagationContext();
@@ -137,11 +137,3 @@ export function getTraceContextFromScope(scope: Scope): TraceContext {
137137

138138
return traceContext;
139139
}
140-
141-
/**
142-
* Get a sentry-trace header value for the currently active scopes.
143-
*/
144-
export function scopesToTraceHeader(scope: Scope): string {
145-
const { traceId, sampled, spanId } = scope.getPropagationContext();
146-
return generateSentryTraceHeader(traceId, spanId, sampled);
147-
}

packages/core/src/tracing/sentryHeaders.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Client, Scope, Span } from '@sentry/types';
2-
import { dynamicSamplingContextToSentryBaggageHeader } from '@sentry/utils';
3-
import { getCurrentScope, scopesToTraceHeader } from '../currentScopes';
2+
import { dynamicSamplingContextToSentryBaggageHeader, generateSentryTraceHeader } from '@sentry/utils';
3+
import { getCurrentScope } from '../currentScopes';
44
import { spanToTraceHeader } from '../utils/spanUtils';
55
import { getDynamicSamplingContextFromScope, getDynamicSamplingContextFromSpan } from './dynamicSamplingContext';
66

@@ -25,3 +25,11 @@ export function getSentryHeaders({
2525
baggage,
2626
};
2727
}
28+
29+
/**
30+
* Get a sentry-trace header value for the given scope.
31+
*/
32+
function scopesToTraceHeader(scope: Scope): string {
33+
const { traceId, sampled, spanId } = scope.getPropagationContext();
34+
return generateSentryTraceHeader(traceId, spanId, sampled);
35+
}

0 commit comments

Comments
 (0)