Skip to content
Open
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
2 changes: 0 additions & 2 deletions packages/nestjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@
"access": "public"
},
"dependencies": {
"@opentelemetry/api": "^1.9.1",
"@opentelemetry/instrumentation": "^0.220.0",
"@sentry/conventions": "^0.16.0",
"@sentry/core": "10.67.0",
"@sentry/node": "10.67.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ export enum AttributeNames {
CONTROLLER = 'nestjs.controller',
CALLBACK = 'nestjs.callback',
}

export enum NestType {
APP_CREATION = 'app_creation',
REQUEST_CONTEXT = 'request_context',
REQUEST_HANDLER = 'handler',
}
9 changes: 4 additions & 5 deletions packages/nestjs/src/integrations/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
withActiveSpan,
} from '@sentry/core';
import { isOrchestrionInjected } from '@sentry/server-utils/orchestrion';
import type { CatchTarget, InjectableTarget, NextFunction, Observable, Subscription } from './types';

/** A function of unknown signature, matching the methods/handlers we wrap. */
Expand Down Expand Up @@ -71,25 +70,25 @@ export function isTargetPatched(target: object, flag: 'sentryPatchedInjectable'

/** Origin for middleware/guard/pipe/interceptor/exception_filter spans. */
function middlewareOrigin(componentType?: string): string {
const base = isOrchestrionInjected() ? 'auto.middleware.orchestrion.nestjs' : 'auto.middleware.nestjs';
const base = 'auto.middleware.orchestrion.nestjs';
return componentType ? `${base}.${componentType}` : base;
}

/**
* Origin for the app-creation / request-context / request-handler HTTP spans.
*/
export function httpOrigin(): string {
return isOrchestrionInjected() ? 'auto.http.orchestrion.nestjs' : 'auto.http.otel.nestjs';
return 'auto.http.orchestrion.nestjs';
}

/** Origin for `@OnEvent` spans. */
function eventOrigin(): string {
return isOrchestrionInjected() ? 'auto.event.orchestrion.nestjs' : 'auto.event.nestjs';
return 'auto.event.orchestrion.nestjs';
}

/** Origin for BullMQ `@Processor` `process` spans. */
function bullmqOrigin(): string {
return isOrchestrionInjected() ? 'auto.queue.orchestrion.nestjs.bullmq' : 'auto.queue.nestjs.bullmq';
return 'auto.queue.orchestrion.nestjs.bullmq';
Comment on lines +73 to +91

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left them as .orchestrion. because Isaac's PR is removing these.

}

/**
Expand Down
46 changes: 1 addition & 45 deletions packages/nestjs/src/integrations/nest.ts
Original file line number Diff line number Diff line change
@@ -1,60 +1,16 @@
import { NestInstrumentation as NestInstrumentationCore } from './vendored/instrumentation';
import { defineIntegration } from '@sentry/core';
import { generateInstrumentOnce } from '@sentry/node';
import { isOrchestrionInjected } from '@sentry/server-utils/orchestrion';
import { subscribeToNestChannels } from './orchestrion-subscriber';
import { SentryNestBullMQInstrumentation } from './sentry-nest-bullmq-instrumentation';
import { SentryNestEventInstrumentation } from './sentry-nest-event-instrumentation';
import { SentryNestInstrumentation } from './sentry-nest-instrumentation';
import { SentryNestScheduleInstrumentation } from './sentry-nest-schedule-instrumentation';

const INTEGRATION_NAME = 'Nest' as const;

const instrumentNestCore = generateInstrumentOnce(`${INTEGRATION_NAME}.Core`, () => {
return new NestInstrumentationCore();
});

const instrumentNestCommon = generateInstrumentOnce(`${INTEGRATION_NAME}.Common`, () => {
return new SentryNestInstrumentation();
});

const instrumentNestEvent = generateInstrumentOnce(`${INTEGRATION_NAME}.Event`, () => {
return new SentryNestEventInstrumentation();
});

const instrumentNestSchedule = generateInstrumentOnce(`${INTEGRATION_NAME}.Schedule`, () => {
return new SentryNestScheduleInstrumentation();
});

const instrumentNestBullMQ = generateInstrumentOnce(`${INTEGRATION_NAME}.BullMQ`, () => {
return new SentryNestBullMQInstrumentation();
});

export const instrumentNest = Object.assign(
(): void => {
instrumentNestCore();
instrumentNestCommon();
instrumentNestEvent();
instrumentNestSchedule();
instrumentNestBullMQ();
},
{ id: INTEGRATION_NAME },
);

/**
* Integration capturing tracing data for NestJS.
* Only the span origin differs between otel and orchestrion implementations.
* See the shared `./wrap-*` helpers
*/
export const nestIntegration = defineIntegration(() => {
return {
name: INTEGRATION_NAME,
setupOnce() {
if (isOrchestrionInjected()) {
subscribeToNestChannels();
} else {
instrumentNest();
}
subscribeToNestChannels();
},
};
});

This file was deleted.

This file was deleted.

115 changes: 0 additions & 115 deletions packages/nestjs/src/integrations/sentry-nest-instrumentation.ts

This file was deleted.

Loading
Loading