Skip to content

Commit

Permalink
fix(nestjs): Inline Observable type to resolve missing 'rxjs' depende…
Browse files Browse the repository at this point in the history
…ncy (#13166)
  • Loading branch information
nicohrubec authored Aug 2, 2024
1 parent 964d050 commit 8a55ab2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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<any> {
Sentry.startSpan({ name: 'test-interceptor-span' }, () => {});
return next.handle().pipe();
}
Expand Down
8 changes: 7 additions & 1 deletion packages/node/src/integrations/tracing/nest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -61,6 +60,13 @@ const supportedVersions = ['>=8.0.0 <11'];

const sentryPatched = 'sentryPatched';

/**
* A minimal interface for an Observable.
*/
export interface Observable<T> {
subscribe(observer: (value: T) => void): void;
}

/**
* A NestJS call handler. Used in interceptors to start the route execution.
*/
Expand Down

0 comments on commit 8a55ab2

Please sign in to comment.