-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
ref(nestjs): Add mechanism
to captured errors
#17312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
@@ -19,12 +19,12 @@ export const SentryCron = (monitorSlug: string, monitorConfig?: MonitorConfig): | |||
try { | |||
result = originalMethod.apply(this, args); | |||
} catch (e) { | |||
captureException(e); | |||
captureException(e, { mechanism: { handled: false, type: 'auto.cron.nestjs' } }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(auto.)cron
is not a listed category, which is a bit suboptimal. The two alternatives are:
function
given we wrap some kind of cron-executed function- omitting the category, since it's not required:
auto.nestjs.sentry_cron
@AbhiPrasad thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
worth noting: I didn't find a specific span that reliably applies here, so there's no direct span counterpart to this mechanism.type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's do auto.function.X
@@ -77,7 +77,7 @@ export function SentryExceptionCaptured() { | |||
return originalCatch.apply(this, [exception, host, ...args]); | |||
} | |||
|
|||
captureException(exception); | |||
captureException(exception, { mechanism: { handled: false, type: 'auto.function.nestjs.exception_captured' } }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think auto.function.*
is correct here, given this decorator can be applied to any arbitrary function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
The NestJS SDK didn't add a mechanism to a bunch of caught errors. This resulted in the errors being incorrectly marked as
handled: true
and themechansim.type
defaulting to'generic'
.This PR:
captureException
calls within the SDK, marking caught exceptions ashandled: false
handled: true
!mechanism.type
, following the naming scheme of trace originI noticed that we have some
startSpan
calls in the SDK that don't include asentry.origin
attribute. I'll open a follow-up PR to fix this separately.ref #17212
closes #17259