Skip to content

Commit ebcf7bf

Browse files
author
Luca Forstner
committed
Remove unused function
1 parent 6d2bfb4 commit ebcf7bf

File tree

3 files changed

+8
-39
lines changed

3 files changed

+8
-39
lines changed

docs/migration/v8-to-v9.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,12 @@ The following changes are unlikely to affect users of the SDK. They are listed h
217217
});
218218
```
219219

220+
### `@sentry/opentelemetry`
221+
222+
- Removed `getPropagationContextFromSpan`.
223+
This function was primarily internally used.
224+
It's functionality was misleading and should not be used.
225+
220226
## 5. Build Changes
221227

222228
Previously the CJS versions of the SDK code (wrongfully) contained compatibility statements for default exports in ESM:

packages/opentelemetry/src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ export { setOpenTelemetryContextAsyncContextStrategy } from './asyncContextStrat
4747
export { wrapContextManagerClass } from './contextManager';
4848
export {
4949
SentryPropagator,
50-
// eslint-disable-next-line deprecation/deprecation
51-
getPropagationContextFromSpan,
5250
shouldPropagateTraceForUrl,
5351
} from './propagator';
5452
export { SentrySpanProcessor } from './spanProcessor';

packages/opentelemetry/src/propagator.ts

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,63 +2,28 @@ import type { Baggage, Context, Span, SpanContext, TextMapGetter, TextMapSetter
22
import { INVALID_TRACEID, TraceFlags, context, propagation, trace } from '@opentelemetry/api';
33
import { W3CBaggagePropagator, isTracingSuppressed } from '@opentelemetry/core';
44
import { ATTR_URL_FULL, SEMATTRS_HTTP_URL } from '@opentelemetry/semantic-conventions';
5-
import type { DynamicSamplingContext, Options, PropagationContext, continueTrace } from '@sentry/core';
5+
import type { DynamicSamplingContext, Options, continueTrace } from '@sentry/core';
66
import {
77
LRUMap,
88
SENTRY_BAGGAGE_KEY_PREFIX,
9-
baggageHeaderToDynamicSamplingContext,
109
generateSentryTraceHeader,
1110
getClient,
1211
getCurrentScope,
1312
getDynamicSamplingContextFromScope,
1413
getDynamicSamplingContextFromSpan,
1514
getIsolationScope,
16-
getRootSpan,
1715
logger,
1816
parseBaggageHeader,
1917
propagationContextFromHeaders,
2018
spanToJSON,
2119
stringMatchesSomePattern,
2220
} from '@sentry/core';
23-
import {
24-
SENTRY_BAGGAGE_HEADER,
25-
SENTRY_TRACE_HEADER,
26-
SENTRY_TRACE_STATE_DSC,
27-
SENTRY_TRACE_STATE_URL,
28-
} from './constants';
21+
import { SENTRY_BAGGAGE_HEADER, SENTRY_TRACE_HEADER, SENTRY_TRACE_STATE_URL } from './constants';
2922
import { DEBUG_BUILD } from './debug-build';
3023
import { getScopesFromContext, setScopesOnContext } from './utils/contextData';
3124
import { getSamplingDecision } from './utils/getSamplingDecision';
3225
import { makeTraceState } from './utils/makeTraceState';
3326
import { setIsSetup } from './utils/setupCheck';
34-
import { spanHasParentId } from './utils/spanTypes';
35-
36-
/**
37-
* Get the Sentry propagation context from a span context.
38-
* @deprecated This method is not used anymore and may be removed in a future major.
39-
*/
40-
export function getPropagationContextFromSpan(span: Span): PropagationContext {
41-
const spanContext = span.spanContext();
42-
const { traceId, traceState } = spanContext;
43-
44-
// When we have a dsc trace state, it means this came from the incoming trace
45-
// Then this takes presedence over the root span
46-
const dscString = traceState ? traceState.get(SENTRY_TRACE_STATE_DSC) : undefined;
47-
const traceStateDsc = dscString ? baggageHeaderToDynamicSamplingContext(dscString) : undefined;
48-
49-
const parentSpanId = spanHasParentId(span) ? span.parentSpanId : undefined;
50-
const sampled = getSamplingDecision(spanContext);
51-
52-
// No trace state? --> Take DSC from root span
53-
const dsc = traceStateDsc || getDynamicSamplingContextFromSpan(getRootSpan(span));
54-
55-
return {
56-
traceId,
57-
sampled,
58-
parentSpanId,
59-
dsc,
60-
};
61-
}
6227

6328
/**
6429
* Injects and extracts `sentry-trace` and `baggage` headers from carriers.

0 commit comments

Comments
 (0)