Skip to content

Commit 48f4f09

Browse files
committed
fix nestjs
1 parent 39502aa commit 48f4f09

File tree

2 files changed

+5
-20
lines changed

2 files changed

+5
-20
lines changed

packages/nestjs/src/integrations/sentry-nest-event-instrumentation.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,28 @@ import {
55
InstrumentationNodeModuleDefinition,
66
InstrumentationNodeModuleFile,
77
} from '@opentelemetry/instrumentation';
8-
import type { SpanAttributes } from '@sentry/core';
98
import { SDK_VERSION, captureException, startSpan } from '@sentry/core';
109
import { getEventSpanOptions } from './helpers';
1110
import type { OnEventTarget } from './types';
1211

1312
const supportedVersions = ['>=2.0.0'];
13+
const COMPONENT = '@nestjs/event-emitter';
1414

1515
/**
1616
* Custom instrumentation for nestjs event-emitter
1717
*
1818
* This hooks into the `OnEvent` decorator, which is applied on event handlers.
1919
*/
2020
export class SentryNestEventInstrumentation extends InstrumentationBase {
21-
public readonly COMPONENT: string;
22-
public readonly COMMON_ATTRIBUTES: SpanAttributes;
23-
2421
public constructor(config: InstrumentationConfig = {}) {
2522
super('sentry-nestjs-event', SDK_VERSION, config);
26-
27-
this.COMPONENT = '@nestjs/event-emitter';
28-
this.COMMON_ATTRIBUTES = {
29-
component: this.COMPONENT,
30-
};
3123
}
3224

3325
/**
3426
* Initializes the instrumentation by defining the modules to be patched.
3527
*/
3628
public init(): InstrumentationNodeModuleDefinition {
37-
const moduleDef = new InstrumentationNodeModuleDefinition(this.COMPONENT, supportedVersions);
29+
const moduleDef = new InstrumentationNodeModuleDefinition(COMPONENT, supportedVersions);
3830

3931
moduleDef.files.push(this._getOnEventFileInstrumentation(supportedVersions));
4032
return moduleDef;

packages/nestjs/src/integrations/sentry-nest-instrumentation.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
InstrumentationNodeModuleDefinition,
66
InstrumentationNodeModuleFile,
77
} from '@opentelemetry/instrumentation';
8-
import type { Span, SpanAttributes } from '@sentry/core';
8+
import type { Span } from '@sentry/core';
99
import {
1010
SDK_VERSION,
1111
addNonEnumerableProperty,
@@ -20,6 +20,7 @@ import { getMiddlewareSpanOptions, getNextProxy, instrumentObservable, isPatched
2020
import type { CallHandler, CatchTarget, InjectableTarget, MinimalNestJsExecutionContext, Observable } from './types';
2121

2222
const supportedVersions = ['>=8.0.0 <11'];
23+
const COMPONENT = '@nestjs/common';
2324

2425
/**
2526
* Custom instrumentation for nestjs.
@@ -29,23 +30,15 @@ const supportedVersions = ['>=8.0.0 <11'];
2930
* 2. @Catch decorator, which is applied on exception filters.
3031
*/
3132
export class SentryNestInstrumentation extends InstrumentationBase {
32-
public readonly COMPONENT: string;
33-
public readonly COMMON_ATTRIBUTES: SpanAttributes;
34-
3533
public constructor(config: InstrumentationConfig = {}) {
3634
super('sentry-nestjs', SDK_VERSION, config);
37-
38-
this.COMPONENT = '@nestjs/common';
39-
this.COMMON_ATTRIBUTES = {
40-
component: this.COMPONENT,
41-
};
4235
}
4336

4437
/**
4538
* Initializes the instrumentation by defining the modules to be patched.
4639
*/
4740
public init(): InstrumentationNodeModuleDefinition {
48-
const moduleDef = new InstrumentationNodeModuleDefinition(this.COMPONENT, supportedVersions);
41+
const moduleDef = new InstrumentationNodeModuleDefinition(COMPONENT, supportedVersions);
4942

5043
moduleDef.files.push(
5144
this._getInjectableFileInstrumentation(supportedVersions),

0 commit comments

Comments
 (0)