@@ -9,7 +9,7 @@ import type {
99import { Catch , Global , HttpException , Injectable , Logger , Module } from '@nestjs/common' ;
1010import { APP_INTERCEPTOR , BaseExceptionFilter } from '@nestjs/core' ;
1111import { captureException , debug , getDefaultIsolationScope , getIsolationScope , isObjectLike , withIsolationScope } from '@sentry/core' ;
12- import type { Observable } from 'rxjs' ;
12+ import { Observable } from 'rxjs' ;
1313import { isExpectedError , isWsOrRpcException } from './helpers' ;
1414
1515// Partial extract of FastifyRequest interface
@@ -53,21 +53,18 @@ class SentryTracingInterceptor implements NestInterceptor {
5353 const client = wsHost . getClient < { nsp ?: { name ?: string } } > ( ) ;
5454 const pattern = wsHost . getPattern ?.( ) ;
5555
56- const source = next . handle ( ) ;
57- return source . lift ( {
58- call ( subscriber , source ) {
59- return withIsolationScope ( isolationScope => {
60- if ( pattern ) {
61- const namespace = client ?. nsp ?. name ;
62- isolationScope . setTransactionName (
63- namespace ? `WS ${ namespace } ${ pattern } ` : `WS ${ pattern } ` ,
64- ) ;
65- }
66-
67- return source . subscribe ( subscriber ) ;
68- } ) ;
69- } ,
70- } ) ;
56+ if ( ! pattern ) {
57+ return next . handle ( ) ;
58+ }
59+
60+ return new Observable ( subscriber =>
61+ withIsolationScope ( isolationScope => {
62+ const namespace = client ?. nsp ?. name ;
63+ isolationScope . setTransactionName ( namespace ? `WS ${ namespace } ${ pattern } ` : `WS ${ pattern } ` ) ;
64+
65+ return next . handle ( ) . subscribe ( subscriber ) ;
66+ } ) ,
67+ ) ;
7168 }
7269
7370 if ( getIsolationScope ( ) === getDefaultIsolationScope ( ) ) {
0 commit comments