Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,15 @@ test('cron instrumentation', async () => {
})
.expect({
event: {
exception: { values: [{ type: 'Error', value: 'Error in cron job' }] },
exception: {
values: [
{
type: 'Error',
value: 'Error in cron job',
mechanism: { type: 'auto.function.cron.instrumentCron', handled: false },
},
],
},
},
})
.start()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,15 @@ test('node-cron instrumentation', async () => {
})
.expect({
event: {
exception: { values: [{ type: 'Error', value: 'Error in cron job' }] },
exception: {
values: [
{
type: 'Error',
value: 'Error in cron job',
mechanism: { type: 'auto.function.node-cron.instrumentNodeCron', handled: false },
},
],
},
},
})
.start()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,15 @@ test('node-schedule instrumentation', async () => {
})
.expect({
event: {
exception: { values: [{ type: 'Error', value: 'Error in cron job' }] },
exception: {
values: [
{
type: 'Error',
value: 'Error in cron job',
mechanism: { type: 'onunhandledrejection', handled: false },
},
],
},
},
})
.start()
Expand Down
14 changes: 12 additions & 2 deletions packages/node-core/src/cron/cron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,12 @@ export function instrumentCron<T>(lib: T & CronJobConstructor, monitorSlug: stri
try {
await onTick(context, onComplete);
} catch (e) {
captureException(e);
captureException(e, {
mechanism: {
handled: false,
type: 'auto.function.cron.instrumentCron',
},
});
throw e;
}
},
Expand Down Expand Up @@ -136,7 +141,12 @@ export function instrumentCron<T>(lib: T & CronJobConstructor, monitorSlug: stri
try {
await onTick(context, onComplete);
} catch (e) {
captureException(e);
captureException(e, {
mechanism: {
handled: false,
type: 'auto.function.cron.instrumentCron',
},
});
throw e;
}
},
Expand Down
7 changes: 6 additions & 1 deletion packages/node-core/src/cron/node-cron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ export function instrumentNodeCron<T>(lib: Partial<NodeCron> & T): T {
try {
return await callback();
} catch (e) {
captureException(e);
captureException(e, {
mechanism: {
handled: false,
type: 'auto.function.node-cron.instrumentNodeCron',
},
});
throw e;
}
},
Expand Down