Skip to content

Commit ee9a9d6

Browse files
authored
feat(v8/node): Remove deprecated anr methods (#10562)
Removes all references to `enableAnrDetection` and the `Anr` integration. Moves us toward #8844 in the node side.
1 parent d024a76 commit ee9a9d6

File tree

17 files changed

+15
-105
lines changed

17 files changed

+15
-105
lines changed

MIGRATION.md

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

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+
3036
## Other changes
3137

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

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ export {
8787
} from '@sentry/core';
8888
export type { SpanStatusType } from '@sentry/core';
8989
export {
90-
// eslint-disable-next-line deprecation/deprecation
91-
enableAnrDetection,
9290
// eslint-disable-next-line deprecation/deprecation
9391
getModuleFromFilename,
9492
DEFAULT_USER_INCLUDES,

packages/node/src/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,6 @@ import { createGetModuleFromFilename } from './module';
108108
export const getModuleFromFilename = createGetModuleFromFilename();
109109
export { createGetModuleFromFilename };
110110

111-
// eslint-disable-next-line deprecation/deprecation
112-
export { enableAnrDetection } from './integrations/anr/legacy';
113-
114111
import { Integrations as CoreIntegrations } from '@sentry/core';
115112

116113
import * as Handlers from './handlers';

packages/node/src/integrations/anr/index.ts

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// TODO (v8): This import can be removed once we only support Node with global URL
22
import { URL } from 'url';
3-
import { convertIntegrationFnToClass, defineIntegration, getCurrentScope } from '@sentry/core';
4-
import type { Client, Contexts, Event, EventHint, Integration, IntegrationClass, IntegrationFn } from '@sentry/types';
3+
import { defineIntegration, getCurrentScope } from '@sentry/core';
4+
import type { Contexts, Event, EventHint, IntegrationFn } from '@sentry/types';
55
import { dynamicRequire, logger } from '@sentry/utils';
66
import type { Worker, WorkerOptions } from 'worker_threads';
77
import type { NodeClient } from '../../client';
@@ -70,23 +70,6 @@ const _anrIntegration = ((options: Partial<AnrIntegrationOptions> = {}) => {
7070

7171
export const anrIntegration = defineIntegration(_anrIntegration);
7272

73-
/**
74-
* Starts a thread to detect App Not Responding (ANR) events
75-
*
76-
* ANR detection requires Node 16.17.0 or later
77-
*
78-
* @deprecated Use `anrIntegration()` instead.
79-
*/
80-
// eslint-disable-next-line deprecation/deprecation
81-
export const Anr = convertIntegrationFnToClass(INTEGRATION_NAME, anrIntegration) as IntegrationClass<
82-
Integration & { setup: (client: NodeClient) => void }
83-
> & {
84-
new (options?: Partial<AnrIntegrationOptions>): Integration & { setup(client: Client): void };
85-
};
86-
87-
// eslint-disable-next-line deprecation/deprecation
88-
export type Anr = typeof Anr;
89-
9073
/**
9174
* Starts the ANR worker thread
9275
*/

packages/node/src/integrations/anr/legacy.ts

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

packages/node/src/integrations/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@ export { Context } from './context';
99
export { RequestData } from '@sentry/core';
1010
export { Undici } from './undici';
1111
export { Spotlight } from './spotlight';
12-
export { Anr } from './anr';
1312
export { Hapi } from './hapi';

packages/remix/src/index.server.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,6 @@ export {
9898
createGetModuleFromFilename,
9999
hapiErrorPlugin,
100100
runWithAsyncContext,
101-
// eslint-disable-next-line deprecation/deprecation
102-
enableAnrDetection,
103101
} from '@sentry/node';
104102

105103
// Keeping the `*` exports for backwards compatibility and types

packages/sveltekit/src/server/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@ export {
9393
hapiErrorPlugin,
9494
metrics,
9595
runWithAsyncContext,
96-
// eslint-disable-next-line deprecation/deprecation
97-
enableAnrDetection,
9896
} from '@sentry/node';
9997

10098
// We can still leave this for the carrier init and type exports

0 commit comments

Comments
 (0)