5
5
InstrumentationNodeModuleDefinition ,
6
6
InstrumentationNodeModuleFile ,
7
7
} from '@opentelemetry/instrumentation' ;
8
- import type { Span , SpanAttributes } from '@sentry/core' ;
8
+ import type { Span } from '@sentry/core' ;
9
9
import {
10
10
SDK_VERSION ,
11
11
addNonEnumerableProperty ,
@@ -20,6 +20,7 @@ import { getMiddlewareSpanOptions, getNextProxy, instrumentObservable, isPatched
20
20
import type { CallHandler , CatchTarget , InjectableTarget , MinimalNestJsExecutionContext , Observable } from './types' ;
21
21
22
22
const supportedVersions = [ '>=8.0.0 <11' ] ;
23
+ const COMPONENT = '@nestjs/common' ;
23
24
24
25
/**
25
26
* Custom instrumentation for nestjs.
@@ -29,23 +30,15 @@ const supportedVersions = ['>=8.0.0 <11'];
29
30
* 2. @Catch decorator, which is applied on exception filters.
30
31
*/
31
32
export class SentryNestInstrumentation extends InstrumentationBase {
32
- public readonly COMPONENT : string ;
33
- public readonly COMMON_ATTRIBUTES : SpanAttributes ;
34
-
35
33
public constructor ( config : InstrumentationConfig = { } ) {
36
34
super ( 'sentry-nestjs' , SDK_VERSION , config ) ;
37
-
38
- this . COMPONENT = '@nestjs/common' ;
39
- this . COMMON_ATTRIBUTES = {
40
- component : this . COMPONENT ,
41
- } ;
42
35
}
43
36
44
37
/**
45
38
* Initializes the instrumentation by defining the modules to be patched.
46
39
*/
47
40
public init ( ) : InstrumentationNodeModuleDefinition {
48
- const moduleDef = new InstrumentationNodeModuleDefinition ( this . COMPONENT , supportedVersions ) ;
41
+ const moduleDef = new InstrumentationNodeModuleDefinition ( COMPONENT , supportedVersions ) ;
49
42
50
43
moduleDef . files . push (
51
44
this . _getInjectableFileInstrumentation ( supportedVersions ) ,
0 commit comments