Skip to content

Commit 157ffcc

Browse files
committed
use trace origin naming scheme, adjust tests
1 parent 168deb8 commit 157ffcc

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export class SentryNestEventInstrumentation extends InstrumentationBase {
112112
captureException(error, {
113113
mechanism: {
114114
handled: false,
115-
type: 'nestjs.on-event',
115+
type: 'auto.event.nestjs',
116116
},
117117
});
118118
throw error;

packages/nestjs/src/setup.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class SentryGlobalFilter extends BaseExceptionFilter {
104104
captureException(exception, {
105105
mechanism: {
106106
handled: false,
107-
type: 'nestjs.graphql',
107+
type: 'auto.graphql.nestjs.global_filter',
108108
},
109109
});
110110
throw exception;
@@ -125,7 +125,7 @@ class SentryGlobalFilter extends BaseExceptionFilter {
125125
captureException(exception, {
126126
mechanism: {
127127
handled: false,
128-
type: 'nestjs.rpc',
128+
type: 'auto.rpc.nestjs.global_filter',
129129
},
130130
});
131131
}
@@ -138,7 +138,7 @@ class SentryGlobalFilter extends BaseExceptionFilter {
138138
captureException(exception, {
139139
mechanism: {
140140
handled: false,
141-
type: 'nestjs.rpc-exception',
141+
type: 'auto.rpc.nestjs.global_filter',
142142
},
143143
});
144144
}
@@ -157,7 +157,7 @@ class SentryGlobalFilter extends BaseExceptionFilter {
157157
captureException(exception, {
158158
mechanism: {
159159
handled: false,
160-
type: 'nestjs.http',
160+
type: 'auto.http.nestjs.global_filter',
161161
},
162162
});
163163
}

packages/nestjs/test/integrations/nest.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,12 @@ describe('Nest', () => {
9797
decorated(mockTarget, 'testMethod', descriptor);
9898

9999
await expect(descriptor.value()).rejects.toThrow(error);
100-
expect(core.captureException).toHaveBeenCalledWith(error);
100+
expect(core.captureException).toHaveBeenCalledWith(error, {
101+
mechanism: {
102+
handled: false,
103+
type: 'auto.event.nestjs',
104+
},
105+
});
101106
});
102107

103108
it('should skip wrapping for internal Sentry handlers', () => {

packages/nestjs/test/sentry-global-filter.test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,12 @@ describe('SentryGlobalFilter', () => {
133133
filter.catch(error, mockArgumentsHost);
134134
}).toThrow(error);
135135

136-
expect(mockCaptureException).toHaveBeenCalledWith(error);
136+
expect(mockCaptureException).toHaveBeenCalledWith(error, {
137+
mechanism: {
138+
handled: false,
139+
type: 'auto.graphql.nestjs.global_filter',
140+
},
141+
});
137142
expect(mockLoggerError).toHaveBeenCalledWith(error.message, error.stack);
138143
});
139144
});

0 commit comments

Comments
 (0)