diff --git a/dev-packages/node-core-integration-tests/suites/cron/cron/test.ts b/dev-packages/node-core-integration-tests/suites/cron/cron/test.ts index 8b9fdfd5c593..c7d0ca5239fc 100644 --- a/dev-packages/node-core-integration-tests/suites/cron/cron/test.ts +++ b/dev-packages/node-core-integration-tests/suites/cron/cron/test.ts @@ -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() diff --git a/dev-packages/node-core-integration-tests/suites/cron/node-cron/test.ts b/dev-packages/node-core-integration-tests/suites/cron/node-cron/test.ts index 1c5fa515e208..fb3e7bacbf45 100644 --- a/dev-packages/node-core-integration-tests/suites/cron/node-cron/test.ts +++ b/dev-packages/node-core-integration-tests/suites/cron/node-cron/test.ts @@ -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() diff --git a/dev-packages/node-core-integration-tests/suites/cron/node-schedule/test.ts b/dev-packages/node-core-integration-tests/suites/cron/node-schedule/test.ts index a2019253203f..19d2d0b4e339 100644 --- a/dev-packages/node-core-integration-tests/suites/cron/node-schedule/test.ts +++ b/dev-packages/node-core-integration-tests/suites/cron/node-schedule/test.ts @@ -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() diff --git a/packages/node-core/src/cron/cron.ts b/packages/node-core/src/cron/cron.ts index ce6225ced2fa..2c764c877c46 100644 --- a/packages/node-core/src/cron/cron.ts +++ b/packages/node-core/src/cron/cron.ts @@ -99,7 +99,12 @@ export function instrumentCron(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; } }, @@ -136,7 +141,12 @@ export function instrumentCron(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; } }, diff --git a/packages/node-core/src/cron/node-cron.ts b/packages/node-core/src/cron/node-cron.ts index 5b9e48900287..a2374b06d4b5 100644 --- a/packages/node-core/src/cron/node-cron.ts +++ b/packages/node-core/src/cron/node-cron.ts @@ -53,7 +53,12 @@ export function instrumentNodeCron(lib: Partial & T): T { try { return await callback(); } catch (e) { - captureException(e); + captureException(e, { + mechanism: { + handled: false, + type: 'auto.function.node-cron.instrumentNodeCron', + }, + }); throw e; } },