Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(nestjs): Inline Observable type to resolve missing 'rxjs' dependency #13166

Merged
merged 2 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
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
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
Loading