Skip to content

Commit 07ca78e

Browse files
authored
feat(core): Deprecate addTracingExtensions (#11579)
Instead, users can use `registerSpanErrorInstrumentation` which is now does much less things than before. I opted to not fully remove this yet because I guess the chance that somebody may have been using this is somewhat high, and we can easily continue to have it with no bundle size hit for those who don't need it. We also couldn't really deprecate this in v7 so I think it's OK to leave this in for now.
1 parent 20706b8 commit 07ca78e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+55
-214
lines changed

MIGRATION.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ We've removed the following packages:
6565
`@sentry/tracing` has been removed and will no longer be published. See
6666
[below](./MIGRATION.md/#3-removal-of-deprecated-apis) for more details.
6767

68-
For Browser SDKs you can import `BrowserTracing` from the SDK directly:
68+
For Browser SDKs you can import `browserTracingIntegration` from the SDK directly:
6969

7070
```js
7171
// v7
@@ -86,12 +86,13 @@ import * as Sentry from '@sentry/browser';
8686
Sentry.init({
8787
dsn: '__DSN__',
8888
tracesSampleRate: 1.0,
89-
integrations: [new Sentry.BrowserTracing()],
89+
integrations: [Sentry.browserTracingIntegration()],
9090
});
9191
```
9292

93-
If you were importing `@sentry/tracing` for the side effect, you can now use `Sentry.addTracingExtensions()` to add the
94-
tracing extensions to the SDK. `addTracingExtensions` replaces the `addExtensionMethods` method from `@sentry/tracing`.
93+
If you don't want to use `browserTracingIntegration` but still manually start spans, you can now use
94+
`Sentry.registerSpanErrorInstrumentation()` to setup handlers for span instrumentation.
95+
`registerSpanErrorInstrumentation` replaces the `addExtensionMethods` method from `@sentry/tracing`.
9596

9697
```js
9798
// v7
@@ -108,7 +109,7 @@ Sentry.init({
108109
// v8
109110
import * as Sentry from '@sentry/browser';
110111

111-
Sentry.addTracingExtensions();
112+
Sentry.registerSpanErrorInstrumentation();
112113

113114
Sentry.init({
114115
dsn: '__DSN__',

dev-packages/browser-integration-tests/suites/public-api/startSpan/init.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import * as Sentry from '@sentry/browser';
22

33
window.Sentry = Sentry;
44

5-
Sentry.addTracingExtensions();
6-
75
Sentry.init({
86
dsn: 'https://[email protected]/1337',
97
tracesSampleRate: 1.0,

packages/browser-utils/test/browser/utils.test.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
1-
import {
2-
SentrySpan,
3-
addTracingExtensions,
4-
getCurrentScope,
5-
getIsolationScope,
6-
setCurrentClient,
7-
spanToJSON,
8-
} from '@sentry/core';
1+
import { SentrySpan, getCurrentScope, getIsolationScope, setCurrentClient, spanToJSON } from '@sentry/core';
92
import { startAndEndSpan } from '../../src/metrics/utils';
103
import { TestClient, getDefaultClientOptions } from '../utils/TestClient';
114

125
describe('startAndEndSpan()', () => {
136
beforeEach(() => {
14-
addTracingExtensions();
15-
167
getCurrentScope().clear();
178
getIsolationScope().clear();
189

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
// This is exported so the loader does not fail when switching off Replay/Tracing
2-
import {
3-
addTracingExtensionsShim,
4-
browserTracingIntegrationShim,
5-
replayIntegrationShim,
6-
} from '@sentry-internal/integration-shims';
1+
import { browserTracingIntegrationShim, replayIntegrationShim } from '@sentry-internal/integration-shims';
72

83
export * from './index.bundle.base';
94

@@ -14,8 +9,4 @@ export {
149
getFeedback,
1510
} from '@sentry-internal/feedback';
1611

17-
export {
18-
browserTracingIntegrationShim as browserTracingIntegration,
19-
addTracingExtensionsShim as addTracingExtensions,
20-
replayIntegrationShim as replayIntegration,
21-
};
12+
export { browserTracingIntegrationShim as browserTracingIntegration, replayIntegrationShim as replayIntegration };

packages/browser/src/index.bundle.replay.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
// This is exported so the loader does not fail when switching off Replay/Tracing
21
import {
3-
addTracingExtensionsShim,
42
browserTracingIntegrationShim,
53
feedbackIntegrationShim,
64
feedbackModalIntegrationShim,
@@ -13,7 +11,6 @@ export { replayIntegration } from '@sentry-internal/replay';
1311

1412
export {
1513
browserTracingIntegrationShim as browserTracingIntegration,
16-
addTracingExtensionsShim as addTracingExtensions,
1714
feedbackIntegrationShim as feedbackIntegration,
1815
feedbackModalIntegrationShim as feedbackModalIntegration,
1916
feedbackScreenshotIntegrationShim as feedbackScreenshotIntegration,

packages/browser/src/index.bundle.tracing.replay.feedback.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { addTracingExtensions } from '@sentry/core';
1+
import { registerSpanErrorInstrumentation } from '@sentry/core';
22

3-
// We are patching the global object with our hub extension methods
4-
addTracingExtensions();
3+
registerSpanErrorInstrumentation();
54

65
export * from './index.bundle.base';
76

@@ -14,7 +13,6 @@ export {
1413
withActiveSpan,
1514
getSpanDescendants,
1615
setMeasurement,
17-
addTracingExtensions,
1816
} from '@sentry/core';
1917

2018
export {

packages/browser/src/index.bundle.tracing.replay.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ import {
33
feedbackModalIntegrationShim,
44
feedbackScreenshotIntegrationShim,
55
} from '@sentry-internal/integration-shims';
6-
import { addTracingExtensions } from '@sentry/core';
6+
import { registerSpanErrorInstrumentation } from '@sentry/core';
77

8-
// We are patching the global object with our hub extension methods
9-
addTracingExtensions();
8+
registerSpanErrorInstrumentation();
109

1110
export * from './index.bundle.base';
1211

@@ -19,7 +18,6 @@ export {
1918
withActiveSpan,
2019
getSpanDescendants,
2120
setMeasurement,
22-
addTracingExtensions,
2321
} from '@sentry/core';
2422

2523
export {

packages/browser/src/index.bundle.tracing.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
// This is exported so the loader does not fail when switching off Replay
21
import {
32
feedbackIntegrationShim,
43
feedbackModalIntegrationShim,
54
feedbackScreenshotIntegrationShim,
65
replayIntegrationShim,
76
} from '@sentry-internal/integration-shims';
8-
import { addTracingExtensions } from '@sentry/core';
7+
import { registerSpanErrorInstrumentation } from '@sentry/core';
98

10-
// We are patching the global object with our hub extension methods
11-
addTracingExtensions();
9+
registerSpanErrorInstrumentation();
1210

1311
export * from './index.bundle.base';
1412

@@ -21,7 +19,6 @@ export {
2119
withActiveSpan,
2220
getSpanDescendants,
2321
setMeasurement,
24-
addTracingExtensions,
2522
} from '@sentry/core';
2623

2724
export {

packages/browser/src/index.bundle.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
// This is exported so the loader does not fail when switching off Replay/Tracing
21
import {
3-
addTracingExtensionsShim,
42
browserTracingIntegrationShim,
53
feedbackIntegrationShim,
64
feedbackModalIntegrationShim,
@@ -11,7 +9,6 @@ import {
119
export * from './index.bundle.base';
1210

1311
export {
14-
addTracingExtensionsShim as addTracingExtensions,
1512
browserTracingIntegrationShim as browserTracingIntegration,
1613
feedbackIntegrationShim as feedbackIntegration,
1714
feedbackModalIntegrationShim as feedbackModalIntegration,

packages/browser/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ export {
4949
} from './tracing/browserTracingIntegration';
5050
export type { RequestInstrumentationOptions } from './tracing/request';
5151
export {
52+
// eslint-disable-next-line deprecation/deprecation
5253
addTracingExtensions,
54+
registerSpanErrorInstrumentation,
5355
getActiveSpan,
5456
getRootSpan,
5557
startSpan,

0 commit comments

Comments
 (0)