Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 10 additions & 1 deletion packages/nestjs/src/decorators.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import type { MonitorConfig } from '@sentry/core';
import { captureException, isThenable } from '@sentry/core';
import {
captureException,
isThenable,
SEMANTIC_ATTRIBUTE_SENTRY_OP,
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
} from '@sentry/core';
import * as Sentry from '@sentry/node';
import { startSpan } from '@sentry/node';
import { isExpectedError } from './helpers';
Expand Down Expand Up @@ -52,6 +57,10 @@ export function SentryTraced(op: string = 'function') {
{
op: op,
name: propertyKey,
attributes: {
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.nestjs.sentry_traced',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: op,
},
},
() => {
return originalMethod.apply(this, args);
Expand Down
5 changes: 5 additions & 0 deletions packages/nestjs/test/decorators.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'reflect-metadata';
import * as core from '@sentry/core';
import { SEMANTIC_ATTRIBUTE_SENTRY_OP, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN } from '@sentry/core';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { SentryCron, SentryExceptionCaptured, SentryTraced } from '../src/decorators';
import * as helpers from '../src/helpers';
Expand Down Expand Up @@ -96,6 +97,10 @@ describe('SentryTraced decorator', () => {
{
op: 'sync-operation',
name: 'syncMethod',
attributes: {
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.function.nestjs.sentry_traced',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'sync-operation',
},
},
expect.any(Function),
);
Expand Down
Loading