Skip to content

Commit 9a62445

Browse files
authored
feat(v8/utils): Remove deprecated util functions (#11143)
ref #9832 Deletes deprecated imports from utils package in preparation to move it to core/related. Also important because deleting `addOrUpdateIntegration` and it's associated tests means that we remove more usages of class based integrations.
1 parent b9e44b9 commit 9a62445

File tree

7 files changed

+2
-392
lines changed

7 files changed

+2
-392
lines changed

MIGRATION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ Removed top-level exports: `tracingOrigins`, `MetricsAggregator`, `metricsAggreg
356356
`Sentry.configureScope`, `Span`, `spanStatusfromHttpCode`, `makeMain`, `lastEventId`, `pushScope`, `popScope`,
357357
`addGlobalEventProcessor`, `timestampWithMs`, `addExtensionMethods`
358358

359-
Remove util exports: `timestampWithMs`
359+
Removed `@sentry/utils` exports: `timestampWithMs`, `addOrUpdateIntegration`, `tracingContextFromHeaders`, `walk`
360360

361361
- [Deprecation of `Hub` and `getCurrentHub()`](./MIGRATION.md#deprecate-hub)
362362
- [Removal of class-based integrations](./MIGRATION.md#removal-of-class-based-integrations)

packages/utils/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export * from './clientreport';
3030
export * from './ratelimit';
3131
export * from './baggage';
3232
export * from './url';
33-
export * from './userIntegrations';
3433
export * from './cache';
3534
export * from './eventbuilder';
3635
export * from './anr';

packages/utils/src/normalize.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,6 @@ function visit(
169169
return normalized;
170170
}
171171

172-
/**
173-
* @deprecated This export will be removed in v8.
174-
*/
175-
export { visit as walk };
176-
177172
/* eslint-disable complexity */
178173
/**
179174
* Stringify the given value. Handles various known special values and types.

packages/utils/src/tracing.ts

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -43,49 +43,6 @@ export function extractTraceparentData(traceparent?: string): TraceparentData |
4343
};
4444
}
4545

46-
/**
47-
* Create tracing context from incoming headers.
48-
*
49-
* @deprecated Use `propagationContextFromHeaders` instead.
50-
*/
51-
// TODO(v8): Remove this function
52-
export function tracingContextFromHeaders(
53-
sentryTrace: Parameters<typeof extractTraceparentData>[0],
54-
baggage: Parameters<typeof baggageHeaderToDynamicSamplingContext>[0],
55-
): {
56-
traceparentData: ReturnType<typeof extractTraceparentData>;
57-
dynamicSamplingContext: ReturnType<typeof baggageHeaderToDynamicSamplingContext>;
58-
propagationContext: PropagationContext;
59-
} {
60-
const traceparentData = extractTraceparentData(sentryTrace);
61-
const dynamicSamplingContext = baggageHeaderToDynamicSamplingContext(baggage);
62-
63-
const { traceId, parentSpanId, parentSampled } = traceparentData || {};
64-
65-
if (!traceparentData) {
66-
return {
67-
traceparentData,
68-
dynamicSamplingContext: undefined,
69-
propagationContext: {
70-
traceId: traceId || uuid4(),
71-
spanId: uuid4().substring(16),
72-
},
73-
};
74-
} else {
75-
return {
76-
traceparentData,
77-
dynamicSamplingContext: dynamicSamplingContext || {}, // If we have traceparent data but no DSC it means we are not head of trace and we must freeze it
78-
propagationContext: {
79-
traceId: traceId || uuid4(),
80-
parentSpanId: parentSpanId || uuid4().substring(16),
81-
spanId: uuid4().substring(16),
82-
sampled: parentSampled,
83-
dsc: dynamicSamplingContext || {}, // If we have traceparent data but no DSC it means we are not head of trace and we must freeze it
84-
},
85-
};
86-
}
87-
}
88-
8946
/**
9047
* Create a propagation context from incoming headers.
9148
*/

packages/utils/src/userIntegrations.ts

Lines changed: 0 additions & 115 deletions
This file was deleted.

packages/utils/test/tracing.test.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
1-
import { extractTraceparentData, propagationContextFromHeaders, tracingContextFromHeaders } from '../src/tracing';
1+
import { extractTraceparentData, propagationContextFromHeaders } from '../src/tracing';
22

33
const EXAMPLE_SENTRY_TRACE = '12312012123120121231201212312012-1121201211212012-1';
44
const EXAMPLE_BAGGAGE = 'sentry-release=1.2.3,sentry-foo=bar,other=baz';
55

6-
describe('tracingContextFromHeaders()', () => {
7-
it('should produce a frozen baggage (empty object) when there is an incoming trace but no baggage header', () => {
8-
// eslint-disable-next-line deprecation/deprecation
9-
const tracingContext = tracingContextFromHeaders('12312012123120121231201212312012-1121201211212012-1', undefined);
10-
expect(tracingContext.dynamicSamplingContext).toEqual({});
11-
expect(tracingContext.propagationContext.dsc).toEqual({});
12-
});
13-
});
14-
156
describe('propagationContextFromHeaders()', () => {
167
it('returns a completely new propagation context when no sentry-trace data is given but baggage data is given', () => {
178
const result = propagationContextFromHeaders(undefined, undefined);

0 commit comments

Comments
 (0)