Skip to content

Commit e043b85

Browse files
committed
feat(v8): Remove deprecated configureScope call
1 parent ca6010b commit e043b85

File tree

44 files changed

+51
-335
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

+51
-335
lines changed

MIGRATION.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ enum. If you were using the `Severity` enum, you should replace it with the `Sev
1111
The `Offline` integration has been removed in favor of the offline transport wrapper:
1212
http://docs.sentry.io/platforms/javascript/configuration/transports/#offline-caching
1313

14+
## Removal of `Sentry.configureScope`.
15+
16+
The top level `Sentry.configureScope` function has been removed. Instead, you should use the `Sentry.getCurrentScope()` to access and mutate the current scope.
17+
1418
# Deprecations in 7.x
1519

1620
You can use the **Experimental** [@sentry/migr8](https://www.npmjs.com/package/@sentry/migr8) to automatically update

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
@@ -469,19 +469,6 @@ export class Hub implements HubInterface {
469469
this.getIsolationScope().setContext(name, context);
470470
}
471471

472-
/**
473-
* @inheritDoc
474-
*
475-
* @deprecated Use `getScope()` directly.
476-
*/
477-
public configureScope(callback: (scope: Scope) => void): void {
478-
// eslint-disable-next-line deprecation/deprecation
479-
const { scope, client } = this.getStackTop();
480-
if (client) {
481-
callback(scope);
482-
}
483-
}
484-
485472
/**
486473
* @inheritDoc
487474
*/

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

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/hub/src/index.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
captureException as captureExceptionCore,
1111
captureMessage as captureMessageCore,
1212
closeSession as closeSessionCore,
13-
configureScope as configureScopeCore,
1413
getCurrentHub as getCurrentHubCore,
1514
getHubFromCarrier as getHubFromCarrierCore,
1615
getMainCarrier as getMainCarrierCore,
@@ -111,12 +110,6 @@ export const captureEvent = captureEventCore;
111110
*/
112111
export const captureMessage = captureMessageCore;
113112

114-
/**
115-
* @deprecated This export has moved to @sentry/core. The @sentry/hub package will be removed in v8.
116-
*/
117-
// eslint-disable-next-line deprecation/deprecation
118-
export const configureScope = configureScopeCore;
119-
120113
/**
121114
* @deprecated This export has moved to @sentry/core. The @sentry/hub package will be removed in v8.
122115
*/

0 commit comments

Comments
 (0)