Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions packages/nestjs/src/integrations/sentry-nest-instrumentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
import type { Span } from '@sentry/core';
import {
SDK_VERSION,
addNonEnumerableProperty,
getActiveSpan,
isThenable,
startInactiveSpan,
Expand Down Expand Up @@ -90,7 +89,9 @@ export class SentryNestInstrumentation extends InstrumentationBase {
/**
* Creates a wrapper function for the @Injectable decorator.
*/
private _createWrapInjectable() {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
private _createWrapInjectable(): (original: any) => (options?: unknown) => (target: InjectableTarget) => any {
const SeenNestjsContextSet = new WeakSet<MinimalNestJsExecutionContext>();
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return function wrapInjectable(original: any) {
return function wrappedInjectable(options?: unknown) {
Expand Down Expand Up @@ -197,8 +198,8 @@ export class SentryNestInstrumentation extends InstrumentationBase {
return withActiveSpan(parentSpan, () => {
const handleReturnObservable = Reflect.apply(originalHandle, thisArgHandle, argsHandle);

if (!context._sentryInterceptorInstrumented) {
addNonEnumerableProperty(context, '_sentryInterceptorInstrumented', true);
if (!SeenNestjsContextSet.has(context)) {
SeenNestjsContextSet.add(context);
afterSpan = startInactiveSpan(
getMiddlewareSpanOptions(target, 'Interceptors - After Route'),
);
Expand All @@ -209,8 +210,8 @@ export class SentryNestInstrumentation extends InstrumentationBase {
} else {
const handleReturnObservable = Reflect.apply(originalHandle, thisArgHandle, argsHandle);

if (!context._sentryInterceptorInstrumented) {
addNonEnumerableProperty(context, '_sentryInterceptorInstrumented', true);
if (!SeenNestjsContextSet.has(context)) {
SeenNestjsContextSet.add(context);
afterSpan = startInactiveSpan(getMiddlewareSpanOptions(target, 'Interceptors - After Route'));
}

Expand Down
Loading