Skip to content

Commit 2014d6a

Browse files
authored
feat(v8): Remove deprecated configureScope call (#10565)
Removes `configureScope`, deprecated in #9887
1 parent 9f0ac34 commit 2014d6a

File tree

41 files changed

+55
-245
lines changed

Some content is hidden

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

41 files changed

+55
-245
lines changed

MIGRATION.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,20 @@ The `enableAnrDetection` and `Anr` class have been removed. See the
3333
[docs](https://docs.sentry.io/platforms/node/configuration/application-not-responding/) for more details how to migrate
3434
to `anrIntegration`, the new integration for ANR detection.
3535

36-
## Other changes
36+
## Removal of `Sentry.configureScope` (#10565)
37+
38+
The top level `Sentry.configureScope` function has been removed. Instead, you should use the `Sentry.getCurrentScope()`
39+
to access and mutate the current scope.
40+
41+
## Deletion of `@sentry/hub` package (#10530)
42+
43+
`@sentry/hub` has been removed. All exports from `@sentry.hub` should be available in `@sentry/core`.
44+
45+
## General API Changes
3746

3847
- Remove `spanStatusfromHttpCode` in favour of `getSpanStatusFromHttpCode` (#10361)
48+
- Remove deprecated `deepReadDirSync` export from `@sentry/node` (#10564)
49+
- Remove `_eventFromIncompleteOnError` usage (#10553)
3950

4051
# Deprecations in 7.x
4152

dev-packages/browser-integration-tests/suites/public-api/configureScope/clear_scope/subject.js

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

dev-packages/browser-integration-tests/suites/public-api/configureScope/clear_scope/test.ts

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

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

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

dev-packages/browser-integration-tests/suites/public-api/configureScope/set_properties/subject.js

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

dev-packages/browser-integration-tests/suites/public-api/configureScope/set_properties/test.ts

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

dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/backgroundtab-custom/subject.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ document.getElementById('go-background').addEventListener('click', () => {
77

88
document.getElementById('start-transaction').addEventListener('click', () => {
99
window.transaction = Sentry.startTransaction({ name: 'test-transaction' });
10-
Sentry.getCurrentHub().configureScope(scope => scope.setSpan(window.transaction));
10+
Sentry.getCurrentScope().setSpan(window.transaction);
1111
});

dev-packages/browser-integration-tests/suites/tracing/browsertracing/backgroundtab-custom/subject.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ document.getElementById('go-background').addEventListener('click', () => {
77

88
document.getElementById('start-transaction').addEventListener('click', () => {
99
window.transaction = Sentry.startTransaction({ name: 'test-transaction' });
10-
Sentry.getCurrentHub().configureScope(scope => scope.setSpan(window.transaction));
10+
Sentry.getCurrentScope().setSpan(window.transaction);
1111
});

packages/astro/src/index.server.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ export {
1717
captureMessage,
1818
captureCheckIn,
1919
withMonitor,
20-
// eslint-disable-next-line deprecation/deprecation
21-
configureScope,
2220
createTransport,
2321
// eslint-disable-next-line deprecation/deprecation
2422
extractTraceparentData,

packages/browser/README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,9 @@ functions will not perform any action before you have called `Sentry.init()`:
3737
import * as Sentry from '@sentry/browser';
3838

3939
// Set user information, as well as tags and further extras
40-
Sentry.configureScope(scope => {
41-
scope.setExtra('battery', 0.7);
42-
scope.setTag('user_mode', 'admin');
43-
scope.setUser({ id: '4711' });
44-
// scope.clear();
45-
});
40+
Sentry.setExtra('battery', 0.7);
41+
Sentry.setTag('user_mode', 'admin');
42+
Sentry.setUser({ id: '4711' });
4643

4744
// Add a breadcrumb for future events
4845
Sentry.addBreadcrumb({

packages/browser/src/exports.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ export {
3030
captureEvent,
3131
captureMessage,
3232
close,
33-
// eslint-disable-next-line deprecation/deprecation
34-
configureScope,
3533
createTransport,
3634
flush,
3735
getHubFromCarrier,

packages/browser/src/loader.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@
184184
'captureMessage',
185185
'captureException',
186186
'captureEvent',
187+
// TODO: Remove configureScope from loader
187188
'configureScope',
188189
'withScope',
189190
'showReportDialog'

packages/browser/src/sdk.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,6 @@ declare const __SENTRY_RELEASE__: string | undefined;
7979
* @example
8080
* ```
8181
*
82-
* import { configureScope } from '@sentry/browser';
83-
* configureScope((scope: Scope) => {
84-
* scope.setExtra({ battery: 0.7 });
85-
* scope.setTag({ user_mode: 'admin' });
86-
* scope.setUser({ id: '4711' });
87-
* });
88-
* ```
89-
*
90-
* @example
91-
* ```
92-
*
9382
* import { addBreadcrumb } from '@sentry/browser';
9483
* addBreadcrumb({
9584
* message: 'My Breadcrumb',

packages/browser/test/package/test-code.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@ Sentry.init({
1717
});
1818

1919
// Configure
20-
Sentry.configureScope(scope => {
21-
scope.setExtra('foo', 'bar');
22-
scope.setFingerprint('foo');
23-
scope.setLevel('warning');
24-
scope.setTag('foo', 'bar');
25-
scope.setUser('foo', 'bar');
26-
});
20+
const scope = Sentry.getCurrentScope();
21+
scope.setExtra('foo', 'bar');
22+
scope.setFingerprint('foo');
23+
scope.setLevel('warning');
24+
scope.setTag('foo', 'bar');
25+
scope.setUser('foo', 'bar');
2726

2827
// Breadcrumbs integration
2928
window.console.log('Console', 'Breadcrumb');

packages/bun/README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,9 @@ functions will not perform any action before you have called `init()`:
3939

4040
```javascript
4141
// Set user information, as well as tags and further extras
42-
Sentry.configureScope(scope => {
43-
scope.setExtra('battery', 0.7);
44-
scope.setTag('user_mode', 'admin');
45-
scope.setUser({ id: '4711' });
46-
// scope.clear();
47-
});
42+
Sentry.setExtra('battery', 0.7);
43+
Sentry.setTag('user_mode', 'admin');
44+
Sentry.setUser({ id: '4711' });
4845

4946
// Add a breadcrumb for future events
5047
Sentry.addBreadcrumb({

packages/bun/src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ export {
3131
captureEvent,
3232
captureMessage,
3333
close,
34-
// eslint-disable-next-line deprecation/deprecation
35-
configureScope,
3634
createTransport,
3735
// eslint-disable-next-line deprecation/deprecation
3836
extractTraceparentData,

packages/bun/src/sdk.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,6 @@ export function getDefaultIntegrations(_options: Options): Integration[] {
7373
* @example
7474
* ```
7575
*
76-
* const { configureScope } = require('@sentry/node');
77-
* configureScope((scope: Scope) => {
78-
* scope.setExtra({ battery: 0.7 });
79-
* scope.setTag({ user_mode: 'admin' });
80-
* scope.setUser({ id: '4711' });
81-
* });
82-
* ```
83-
*
84-
* @example
85-
* ```
86-
*
8776
* const { addBreadcrumb } = require('@sentry/node');
8877
* addBreadcrumb({
8978
* message: 'My Breadcrumb',

packages/core/src/exports.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,6 @@ export function captureEvent(event: Event, hint?: EventHint): string {
7676
return getCurrentHub().captureEvent(event, hint);
7777
}
7878

79-
/**
80-
* Callback to set context information onto the scope.
81-
* @param callback Callback function that receives Scope.
82-
*
83-
* @deprecated Use getCurrentScope() directly.
84-
*/
85-
export function configureScope(callback: (scope: Scope) => void): ReturnType<Hub['configureScope']> {
86-
// eslint-disable-next-line deprecation/deprecation
87-
getCurrentHub().configureScope(callback);
88-
}
89-
9079
/**
9180
* Records a new breadcrumb which will be attached to future events.
9281
*

packages/core/src/hub.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -507,19 +507,6 @@ export class Hub implements HubInterface {
507507
this.getIsolationScope().setContext(name, context);
508508
}
509509

510-
/**
511-
* @inheritDoc
512-
*
513-
* @deprecated Use `getScope()` directly.
514-
*/
515-
public configureScope(callback: (scope: Scope) => void): void {
516-
// eslint-disable-next-line deprecation/deprecation
517-
const { scope, client } = this.getStackTop();
518-
if (client) {
519-
callback(scope);
520-
}
521-
}
522-
523510
/**
524511
* @inheritDoc
525512
*/

packages/core/src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ export {
1616
captureEvent,
1717
captureMessage,
1818
close,
19-
// eslint-disable-next-line deprecation/deprecation
20-
configureScope,
2119
flush,
2220
// eslint-disable-next-line deprecation/deprecation
2321
startTransaction,

packages/deno/README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,9 @@ functions will not perform any action before you have called `init()`:
4141

4242
```javascript
4343
// Set user information, as well as tags and further extras
44-
Sentry.configureScope(scope => {
45-
scope.setExtra('battery', 0.7);
46-
scope.setTag('user_mode', 'admin');
47-
scope.setUser({ id: '4711' });
48-
// scope.clear();
49-
});
44+
Sentry.setExtra('battery', 0.7);
45+
Sentry.setTag('user_mode', 'admin');
46+
Sentry.setUser({ id: '4711' });
5047

5148
// Add a breadcrumb for future events
5249
Sentry.addBreadcrumb({

packages/deno/src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ export {
2929
captureEvent,
3030
captureMessage,
3131
close,
32-
// eslint-disable-next-line deprecation/deprecation
33-
configureScope,
3432
createTransport,
3533
// eslint-disable-next-line deprecation/deprecation
3634
extractTraceparentData,

packages/deno/src/sdk.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,6 @@ const defaultStackParser: StackParser = createStackParser(nodeStackLineParser())
6565
* @example
6666
* ```
6767
*
68-
* import { configureScope } from 'npm:@sentry/deno';
69-
* configureScope((scope: Scope) => {
70-
* scope.setExtra({ battery: 0.7 });
71-
* scope.setTag({ user_mode: 'admin' });
72-
* scope.setUser({ id: '4711' });
73-
* });
74-
* ```
75-
*
76-
* @example
77-
* ```
78-
*
7968
* import { addBreadcrumb } from 'npm:@sentry/deno';
8069
* addBreadcrumb({
8170
* message: 'My Breadcrumb',

packages/nextjs/README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,9 @@ To set context information or send manual events, use the exported functions of
5353
import * as Sentry from '@sentry/nextjs';
5454

5555
// Set user information, as well as tags and further extras
56-
Sentry.configureScope(scope => {
57-
scope.setExtra('battery', 0.7);
58-
scope.setTag('user_mode', 'admin');
59-
scope.setUser({ id: '4711' });
60-
// scope.clear();
61-
});
56+
Sentry.setExtra('battery', 0.7);
57+
Sentry.setTag('user_mode', 'admin');
58+
Sentry.setUser({ id: '4711' });
6259

6360
// Add a breadcrumb for future events
6461
Sentry.addBreadcrumb({

packages/nextjs/vercel/install-sentry-from-branch.sh

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,12 @@ Error.stackTraceLimit = Infinity;
7171

7272
SDK_COMMIT_MESSAGE=$(cd sentry-javascript && git log --format="%C(auto)%s" | head -n 1)
7373
CONFIGURE_SCOPE_CODE="
74-
Sentry.configureScope(scope => {
75-
if (process.env.VERCEL) {
76-
scope.setTag('vercel', true);
77-
}
78-
scope.setTag('commitMessage', process.env.VERCEL_GIT_COMMIT_MESSAGE);
79-
scope.setTag('sdkCommitMessage', \"$SDK_COMMIT_MESSAGE\");
80-
});
81-
"
74+
if (process.env.VERCEL) {
75+
Sentry.setTag('vercel', true);
76+
}
77+
Sentry.setTag('commitMessage', process.env.VERCEL_GIT_COMMIT_MESSAGE);
78+
Sentry.setTag('sdkCommitMessage', \"$SDK_COMMIT_MESSAGE\");
79+
"
8280

8381
echo "$INFINITE_STACKTRACE_CODE" "$CONFIGURE_SCOPE_CODE" >>sentry.server.config.js
8482
echo "$INFINITE_STACKTRACE_CODE" "$CONFIGURE_SCOPE_CODE" >>sentry.client.config.js

packages/node-experimental/src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ export {
4545
withScope,
4646
withIsolationScope,
4747
withActiveSpan,
48-
// eslint-disable-next-line deprecation/deprecation
49-
configureScope,
5048
getCurrentScope,
5149
getGlobalScope,
5250
getIsolationScope,

packages/node-experimental/src/sdk/api.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,6 @@ export function withIsolationScope<T>(callback: (isolationScope: Scope) => T): T
9696
});
9797
}
9898

99-
/**
100-
* Configure the current scope.
101-
* @deprecated Use `getCurrentScope()` instead.
102-
*/
103-
export function configureScope(callback: (scope: Scope) => void): void {
104-
callback(getCurrentScope());
105-
}
106-
10799
/** Record an exception and send it to Sentry. */
108100
export function captureException(exception: unknown, hint?: ExclusiveEventHintOrCaptureContext): string {
109101
return getCurrentScope().captureException(exception, parseEventHintOrCaptureContext(hint));

packages/node-experimental/src/sdk/hub.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { endSession, startSession } from '@sentry/core';
1313
import {
1414
addBreadcrumb,
1515
captureEvent,
16-
configureScope,
1716
getClient,
1817
getCurrentScope,
1918
setContext,
@@ -77,8 +76,6 @@ export function getCurrentHub(): Hub {
7776
setExtra,
7877
setExtras,
7978
setContext,
80-
// eslint-disable-next-line deprecation/deprecation
81-
configureScope: configureScope,
8279

8380
run(callback: (hub: Hub) => void): void {
8481
// eslint-disable-next-line @typescript-eslint/no-explicit-any

0 commit comments

Comments
 (0)