Skip to content

Commit ee1a06a

Browse files
committed
feat(v8): Remove deprecated configureScope call
1 parent 9f0ac34 commit ee1a06a

File tree

44 files changed

+997
-236
lines changed

Some content is hidden

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

44 files changed

+997
-236
lines changed

MIGRATION.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ 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+
## Removal of `Sentry.configureScope`.
37+
38+
The top level `Sentry.configureScope` function has been removed. Instead, you should use the `Sentry.getCurrentScope()` to access and mutate the current scope.
39+
3640
## Other changes
3741

3842
- Remove `spanStatusfromHttpCode` in favour of `getSpanStatusFromHttpCode` (#10361)

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',

0 commit comments

Comments
 (0)