Skip to content

Commit cd35c52

Browse files
authored
Merge branch 'develop' into metrics-summary
2 parents 5c074bf + 31faca3 commit cd35c52

File tree

144 files changed

+749
-2065
lines changed

Some content is hidden

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

144 files changed

+749
-2065
lines changed

MIGRATION.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Upgrading from 7.x to 8.x
22

3+
## Removal of deprecated API in `@sentry/nextjs`
4+
5+
The following previously deprecated API has been removed from the `@sentry/nextjs` package:
6+
7+
- `withSentryApi` (Replacement: `wrapApiHandlerWithSentry`)
8+
- `withSentryAPI` (Replacement: `wrapApiHandlerWithSentry`)
9+
- `withSentryGetServerSideProps` (Replacement: `wrapGetServerSidePropsWithSentry`)
10+
- `withSentryGetStaticProps` (Replacement: `wrapGetStaticPropsWithSentry`)
11+
- `withSentryServerSideGetInitialProps` (Replacement: `wrapGetInitialPropsWithSentry`)
12+
- `withSentryServerSideAppGetInitialProps` (Replacement: `wrapAppGetInitialPropsWithSentry`)
13+
- `withSentryServerSideDocumentGetInitialProps` (Replacement: `wrapDocumentGetInitialPropsWithSentry`)
14+
- `withSentryServerSideErrorGetInitialProps` was renamed to `wrapErrorGetInitialPropsWithSentry`
15+
- `nextRouterInstrumentation` (Replaced by using `browserTracingIntegration`)
16+
- `IS_BUILD`
17+
- `isBuild`
18+
319
## Removal of Severity Enum
420

521
In v7 we deprecated the `Severity` enum in favor of using the `SeverityLevel` type. In v8 we removed the `Severity`
@@ -11,9 +27,26 @@ enum. If you were using the `Severity` enum, you should replace it with the `Sev
1127
The `Offline` integration has been removed in favor of the offline transport wrapper:
1228
http://docs.sentry.io/platforms/javascript/configuration/transports/#offline-caching
1329

14-
## Other changes
30+
## Removal of `enableAnrDetection` and `Anr` class (##10562)
31+
32+
The `enableAnrDetection` and `Anr` class have been removed. See the
33+
[docs](https://docs.sentry.io/platforms/node/configuration/application-not-responding/) for more details how to migrate
34+
to `anrIntegration`, the new integration for ANR detection.
35+
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
1546

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

1851
# Deprecations in 7.x
1952

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
});

dev-packages/e2e-tests/test-applications/create-next-app/pages/api/success.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,7 @@ import * as Sentry from '@sentry/nextjs';
33
import type { NextApiRequest, NextApiResponse } from 'next';
44

55
export default function handler(req: NextApiRequest, res: NextApiResponse) {
6-
// eslint-disable-next-line deprecation/deprecation
7-
const transaction = Sentry.startTransaction({ name: 'test-transaction', op: 'e2e-test' });
8-
// eslint-disable-next-line deprecation/deprecation
9-
Sentry.getCurrentScope().setSpan(transaction);
10-
11-
// eslint-disable-next-line deprecation/deprecation
12-
const span = transaction.startChild();
13-
14-
span.end();
15-
transaction.end();
6+
Sentry.startSpan({ name: 'test-span' }, span => undefined);
167

178
Sentry.flush().then(() => {
189
res.status(200).json({

dev-packages/e2e-tests/test-applications/node-exports-test-app/scripts/consistentExports.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const DEPENDENTS: Dependent[] = [
6060
{
6161
package: '@sentry/serverless',
6262
exports: Object.keys(SentryServerless),
63-
ignoreExports: ['cron', 'hapiErrorPlugin', 'enableAnrDetection'],
63+
ignoreExports: ['cron', 'hapiErrorPlugin'],
6464
},
6565
{
6666
package: '@sentry/sveltekit',

dev-packages/node-integration-tests/suites/anr/basic-session.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Sentry.init({
1111
dsn: 'https://[email protected]/1337',
1212
release: '1.0',
1313
debug: true,
14-
integrations: [new Sentry.Integrations.Anr({ captureStackTrace: true, anrThreshold: 100 })],
14+
integrations: [Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100 })],
1515
});
1616

1717
function longWork() {

dev-packages/node-integration-tests/suites/anr/basic.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Sentry.init({
1212
release: '1.0',
1313
debug: true,
1414
autoSessionTracking: false,
15-
integrations: [new Sentry.Integrations.Anr({ captureStackTrace: true, anrThreshold: 100 })],
15+
integrations: [Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100 })],
1616
});
1717

1818
function longWork() {

dev-packages/node-integration-tests/suites/anr/basic.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Sentry.init({
1212
release: '1.0',
1313
debug: true,
1414
autoSessionTracking: false,
15-
integrations: [new Sentry.Integrations.Anr({ captureStackTrace: true, anrThreshold: 100 })],
15+
integrations: [Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100 })],
1616
});
1717

1818
function longWork() {

dev-packages/node-integration-tests/suites/anr/forked.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Sentry.init({
1212
release: '1.0',
1313
debug: true,
1414
autoSessionTracking: false,
15-
integrations: [new Sentry.Integrations.Anr({ captureStackTrace: true, anrThreshold: 100 })],
15+
integrations: [Sentry.anrIntegration({ captureStackTrace: true, anrThreshold: 100 })],
1616
});
1717

1818
function longWork() {

dev-packages/node-integration-tests/suites/anr/legacy.js

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

dev-packages/node-integration-tests/suites/anr/should-exit-forced.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function configureSentry() {
66
release: '1.0',
77
debug: true,
88
autoSessionTracking: false,
9-
integrations: [new Sentry.Integrations.Anr({ captureStackTrace: true })],
9+
integrations: [Sentry.anrIntegration({ captureStackTrace: true })],
1010
});
1111
}
1212

dev-packages/node-integration-tests/suites/anr/should-exit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function configureSentry() {
66
release: '1.0',
77
debug: true,
88
autoSessionTracking: false,
9-
integrations: [new Sentry.Integrations.Anr({ captureStackTrace: true })],
9+
integrations: [Sentry.anrIntegration({ captureStackTrace: true })],
1010
});
1111
}
1212

dev-packages/node-integration-tests/suites/anr/test.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@ conditionalTest({ min: 16 })('should report ANR when event loop blocked', () =>
5656
cleanupChildProcesses();
5757
});
5858

59-
// TODO (v8): Remove this old API and this test
60-
test('Legacy API', done => {
61-
createRunner(__dirname, 'legacy.js').expect({ event: EXPECTED_ANR_EVENT }).start(done);
62-
});
63-
6459
test('CJS', done => {
6560
createRunner(__dirname, 'basic.js').expect({ event: EXPECTED_ANR_EVENT }).start(done);
6661
});

packages/angular-ivy/scripts/prepack.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ type PackageJson = {
66
type?: string;
77
nx?: string;
88
volta?: any;
9+
exports?: Record<string, string | Record<string, string>>;
910
};
1011

1112
const buildDir = path.join(process.cwd(), 'build');
@@ -18,6 +19,18 @@ const pkgJson: PackageJson = JSON.parse(fs.readFileSync(pkjJsonPath).toString())
1819
delete pkgJson.main;
1920
pkgJson.type = 'module';
2021

22+
pkgJson.exports = {
23+
'.': {
24+
es2015: './fesm2015/sentry-angular-ivy.js',
25+
esm2015: './esm2015/sentry-angular-ivy.js',
26+
fesm2015: './fesm2015/sentry-angular-ivy.js',
27+
import: './fesm2015/sentry-angular-ivy.js',
28+
require: './bundles/sentry-angular-ivy.umd.js',
29+
types: './sentry-angular-ivy.d.ts',
30+
},
31+
'./*': './*',
32+
};
33+
2134
// no need to keep around other properties that are only relevant for our reop:
2235
delete pkgJson.nx;
2336
delete pkgJson.volta;

packages/angular/src/errorhandler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class SentryErrorHandler implements AngularErrorHandler {
118118
if (this._options.showDialog) {
119119
const client = Sentry.getClient();
120120

121-
if (client && client.on && !this._registeredAfterSendEventHandler) {
121+
if (client && !this._registeredAfterSendEventHandler) {
122122
client.on('afterSendEvent', (event: Event) => {
123123
if (!event.type) {
124124
// eslint-disable-next-line deprecation/deprecation
@@ -128,7 +128,7 @@ class SentryErrorHandler implements AngularErrorHandler {
128128

129129
// We only want to register this hook once in the lifetime of the error handler
130130
this._registeredAfterSendEventHandler = true;
131-
} else if (!client || !client.on) {
131+
} else if (!client) {
132132
Sentry.showReportDialog({ ...this._options.dialogOptions, eventId });
133133
}
134134
}

packages/astro/src/index.server.ts

Lines changed: 0 additions & 4 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,
@@ -58,8 +56,6 @@ export {
5856
defaultIntegrations,
5957
getDefaultIntegrations,
6058
defaultStackParser,
61-
// eslint-disable-next-line deprecation/deprecation
62-
lastEventId,
6359
flush,
6460
close,
6561
getSentryRelease,

packages/astro/src/index.types.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,4 @@ export declare const defaultStackParser: StackParser;
2626
export declare function close(timeout?: number | undefined): PromiseLike<boolean>;
2727
export declare function flush(timeout?: number | undefined): PromiseLike<boolean>;
2828

29-
/**
30-
* @deprecated This function will be removed in the next major version of the Sentry SDK.
31-
*/
32-
export declare function lastEventId(): string | undefined;
33-
3429
export default sentryAstro;

packages/astro/test/client/sdk.test.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import type { BrowserClient } from '@sentry/browser';
22
import { getActiveSpan } from '@sentry/browser';
3-
import { browserTracingIntegration, getCurrentScope } from '@sentry/browser';
3+
import { browserTracingIntegration } from '@sentry/browser';
44
import * as SentryBrowser from '@sentry/browser';
55
import { BrowserTracing, SDK_VERSION, WINDOW, getClient } from '@sentry/browser';
66
import { vi } from 'vitest';
77

8+
import { getIsolationScope } from '@sentry/core';
89
import { init } from '../../../astro/src/client/sdk';
910

1011
const browserInit = vi.spyOn(SentryBrowser, 'init');
@@ -38,16 +39,16 @@ describe('Sentry client SDK', () => {
3839
);
3940
});
4041

41-
it('sets the runtime tag on the scope', () => {
42-
const currentScope = getCurrentScope();
42+
it('sets the runtime tag on the isolation scope', () => {
43+
const isolationScope = getIsolationScope();
4344

4445
// @ts-expect-error need access to protected _tags attribute
45-
expect(currentScope._tags).toEqual({});
46+
expect(isolationScope._tags).toEqual({});
4647

4748
init({ dsn: 'https://[email protected]/1337' });
4849

4950
// @ts-expect-error need access to protected _tags attribute
50-
expect(currentScope._tags).toEqual({ runtime: 'browser' });
51+
expect(isolationScope._tags).toEqual({ runtime: 'browser' });
5152
});
5253

5354
describe('automatically adds integrations', () => {

packages/astro/test/server/sdk.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@ describe('Sentry server SDK', () => {
3636
);
3737
});
3838

39-
it('sets the runtime tag on the scope', () => {
40-
const currentScope = SentryNode.getCurrentScope();
39+
it('sets the runtime tag on the isolation scope', () => {
40+
const isolationScope = SentryNode.getIsolationScope();
4141

4242
// @ts-expect-error need access to protected _tags attribute
43-
expect(currentScope._tags).toEqual({});
43+
expect(isolationScope._tags).toEqual({});
4444

4545
init({ dsn: 'https://[email protected]/1337' });
4646

4747
// @ts-expect-error need access to protected _tags attribute
48-
expect(currentScope._tags).toEqual({ runtime: 'node' });
48+
expect(isolationScope._tags).toEqual({ runtime: 'node' });
4949
});
5050
});
5151
});

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({

0 commit comments

Comments
 (0)