From 4f847ee45c852336d0f397b0ea112864c1e7a763 Mon Sep 17 00:00:00 2001 From: nicohrubec Date: Fri, 2 Aug 2024 09:42:22 +0200 Subject: [PATCH 1/2] Inline observable type --- packages/node/src/integrations/tracing/nest.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/node/src/integrations/tracing/nest.ts b/packages/node/src/integrations/tracing/nest.ts index 6b452ab3add3..b3d1b3547118 100644 --- a/packages/node/src/integrations/tracing/nest.ts +++ b/packages/node/src/integrations/tracing/nest.ts @@ -23,7 +23,6 @@ import { } from '@sentry/core'; import type { IntegrationFn, Span } from '@sentry/types'; import { addNonEnumerableProperty, logger } from '@sentry/utils'; -import type { Observable } from 'rxjs'; import { generateInstrumentOnce } from '../../otel/instrument'; interface MinimalNestJsExecutionContext { @@ -61,6 +60,13 @@ const supportedVersions = ['>=8.0.0 <11']; const sentryPatched = 'sentryPatched'; +/** + * A minimal interface for an Observable. + */ +export interface Observable { + subscribe(observer: (value: T) => void): void; +} + /** * A NestJS call handler. Used in interceptors to start the route execution. */ From 6356967aa61e9174cbd1bb8ac3f0eaeb35cb7105 Mon Sep 17 00:00:00 2001 From: nicohrubec Date: Fri, 2 Aug 2024 10:33:32 +0200 Subject: [PATCH 2/2] fix tests --- .../node-nestjs-basic/src/example.interceptor.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev-packages/e2e-tests/test-applications/node-nestjs-basic/src/example.interceptor.ts b/dev-packages/e2e-tests/test-applications/node-nestjs-basic/src/example.interceptor.ts index 75c301b4cffc..260c1798449f 100644 --- a/dev-packages/e2e-tests/test-applications/node-nestjs-basic/src/example.interceptor.ts +++ b/dev-packages/e2e-tests/test-applications/node-nestjs-basic/src/example.interceptor.ts @@ -1,9 +1,10 @@ import { CallHandler, ExecutionContext, Injectable, NestInterceptor } from '@nestjs/common'; import * as Sentry from '@sentry/nestjs'; +import { Observable } from 'rxjs'; @Injectable() export class ExampleInterceptor implements NestInterceptor { - intercept(context: ExecutionContext, next: CallHandler) { + intercept(context: ExecutionContext, next: CallHandler): Observable { Sentry.startSpan({ name: 'test-interceptor-span' }, () => {}); return next.handle().pipe(); }