Skip to content

Commit e35dc22

Browse files
authored
feat(nestjs): Deprecate SentryTracingInterceptor, SentryService, SentryGlobalGenericFilter, SentryGlobalGraphQLFilter (#14371)
1 parent 0aadc9b commit e35dc22

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

docs/migration/draft-v9-migration-guide.md

+12
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@
1717
## `@sentry/nestjs`
1818

1919
- Deprecated `@WithSentry`. Use `@SentryExceptionCaptured` instead.
20+
- Deprecated `SentryTracingInterceptor`.
21+
If you are using `@sentry/nestjs` you can safely remove any references to the `SentryTracingInterceptor`.
22+
If you are using another package migrate to `@sentry/nestjs` and remove the `SentryTracingInterceptor` afterwards.
23+
- Deprecated `SentryService`.
24+
If you are using `@sentry/nestjs` you can safely remove any references to the `SentryService`.
25+
If you are using another package migrate to `@sentry/nestjs` and remove the `SentryService` afterwards.
26+
- Deprecated `SentryGlobalGenericFilter`.
27+
Use the `SentryGlobalFilter` instead.
28+
The `SentryGlobalFilter` is a drop-in replacement.
29+
- Deprecated `SentryGlobalGraphQLFilter`.
30+
Use the `SentryGlobalFilter` instead.
31+
The `SentryGlobalFilter` is a drop-in replacement.
2032

2133
## `@sentry/types`
2234

packages/nestjs/src/setup.ts

+25
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ import { isExpectedError } from './helpers';
2929

3030
/**
3131
* Interceptor to add Sentry tracing capabilities to Nest.js applications.
32+
*
33+
* @deprecated `SentryTracingInterceptor` is deprecated.
34+
* If you are using `@sentry/nestjs` you can safely remove any references to the `SentryTracingInterceptor`.
35+
* If you are using another package migrate to `@sentry/nestjs` and remove the `SentryTracingInterceptor` afterwards.
3236
*/
3337
class SentryTracingInterceptor implements NestInterceptor {
3438
// used to exclude this class from being auto-instrumented
@@ -59,7 +63,9 @@ class SentryTracingInterceptor implements NestInterceptor {
5963
return next.handle();
6064
}
6165
}
66+
// eslint-disable-next-line deprecation/deprecation
6267
Injectable()(SentryTracingInterceptor);
68+
// eslint-disable-next-line deprecation/deprecation
6369
export { SentryTracingInterceptor };
6470

6571
/**
@@ -108,6 +114,8 @@ export { SentryGlobalFilter };
108114

109115
/**
110116
* Global filter to handle exceptions in NestJS + GraphQL applications and report them to Sentry.
117+
*
118+
* @deprecated `SentryGlobalGraphQLFilter` is deprecated. Use the `SentryGlobalFilter` instead. The `SentryGlobalFilter` is a drop-in replacement.
111119
*/
112120
class SentryGlobalGraphQLFilter {
113121
private static readonly _logger = new Logger('ExceptionsHandler');
@@ -127,24 +135,33 @@ class SentryGlobalGraphQLFilter {
127135
throw exception;
128136
}
129137
if (exception instanceof Error) {
138+
// eslint-disable-next-line deprecation/deprecation
130139
SentryGlobalGraphQLFilter._logger.error(exception.message, exception.stack);
131140
}
132141
captureException(exception);
133142
throw exception;
134143
}
135144
}
145+
// eslint-disable-next-line deprecation/deprecation
136146
Catch()(SentryGlobalGraphQLFilter);
147+
// eslint-disable-next-line deprecation/deprecation
137148
export { SentryGlobalGraphQLFilter };
138149

139150
/**
140151
* Global filter to handle exceptions and report them to Sentry.
141152
*
142153
* This filter is a generic filter that can handle both HTTP and GraphQL exceptions.
154+
*
155+
* @deprecated `SentryGlobalGenericFilter` is deprecated. Use the `SentryGlobalFilter` instead. The `SentryGlobalFilter` is a drop-in replacement.
143156
*/
144157
export const SentryGlobalGenericFilter = SentryGlobalFilter;
145158

146159
/**
147160
* Service to set up Sentry performance tracing for Nest.js applications.
161+
*
162+
* @deprecated `SentryService` is deprecated.
163+
* If you are using `@sentry/nestjs` you can safely remove any references to the `SentryService`.
164+
* If you are using another package migrate to `@sentry/nestjs` and remove the `SentryService` afterwards.
148165
*/
149166
class SentryService implements OnModuleInit {
150167
public readonly __SENTRY_INTERNAL__: boolean;
@@ -168,7 +185,9 @@ class SentryService implements OnModuleInit {
168185
}
169186
}
170187
}
188+
// eslint-disable-next-line deprecation/deprecation
171189
Injectable()(SentryService);
190+
// eslint-disable-next-line deprecation/deprecation
172191
export { SentryService };
173192

174193
/**
@@ -182,25 +201,31 @@ class SentryModule {
182201
return {
183202
module: SentryModule,
184203
providers: [
204+
// eslint-disable-next-line deprecation/deprecation
185205
SentryService,
186206
{
187207
provide: APP_INTERCEPTOR,
208+
// eslint-disable-next-line deprecation/deprecation
188209
useClass: SentryTracingInterceptor,
189210
},
190211
],
212+
// eslint-disable-next-line deprecation/deprecation
191213
exports: [SentryService],
192214
};
193215
}
194216
}
195217
Global()(SentryModule);
196218
Module({
197219
providers: [
220+
// eslint-disable-next-line deprecation/deprecation
198221
SentryService,
199222
{
200223
provide: APP_INTERCEPTOR,
224+
// eslint-disable-next-line deprecation/deprecation
201225
useClass: SentryTracingInterceptor,
202226
},
203227
],
228+
// eslint-disable-next-line deprecation/deprecation
204229
exports: [SentryService],
205230
})(SentryModule);
206231
export { SentryModule };

0 commit comments

Comments
 (0)