Skip to content

Commit 0c60aa2

Browse files
committed
adjust tests
1 parent 8f89b0f commit 0c60aa2

File tree

5 files changed

+30
-12
lines changed

5 files changed

+30
-12
lines changed

dev-packages/node-core-integration-tests/suites/cron/cron/test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,15 @@ test('cron instrumentation', async () => {
6969
})
7070
.expect({
7171
event: {
72-
exception: { values: [{ type: 'Error', value: 'Error in cron job' }] },
72+
exception: {
73+
values: [
74+
{
75+
type: 'Error',
76+
value: 'Error in cron job',
77+
mechanism: { type: 'auto.function.cron.instrumentCron', handled: false },
78+
},
79+
],
80+
},
7381
},
7482
})
7583
.start()

dev-packages/node-core-integration-tests/suites/cron/node-cron/test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,15 @@ test('node-cron instrumentation', async () => {
6969
})
7070
.expect({
7171
event: {
72-
exception: { values: [{ type: 'Error', value: 'Error in cron job' }] },
72+
exception: {
73+
values: [
74+
{
75+
type: 'Error',
76+
value: 'Error in cron job',
77+
mechanism: { type: 'auto.function.node-cron.instrumentNodeCron', handled: false },
78+
},
79+
],
80+
},
7381
},
7482
})
7583
.start()

dev-packages/node-core-integration-tests/suites/cron/node-schedule/test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,15 @@ test('node-schedule instrumentation', async () => {
6969
})
7070
.expect({
7171
event: {
72-
exception: { values: [{ type: 'Error', value: 'Error in cron job' }] },
72+
exception: {
73+
values: [
74+
{
75+
type: 'Error',
76+
value: 'Error in cron job',
77+
mechanism: { type: 'onunhandledrejection', handled: false },
78+
},
79+
],
80+
},
7381
},
7482
})
7583
.start()

packages/node-core/src/cron/cron.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,7 @@ export function instrumentCron<T>(lib: T & CronJobConstructor, monitorSlug: stri
102102
captureException(e, {
103103
mechanism: {
104104
handled: false,
105-
type: 'cron.instrumentCron',
106-
data: {
107-
function: 'constructor',
108-
},
105+
type: 'auto.function.cron.instrumentCron',
109106
},
110107
});
111108
throw e;
@@ -147,10 +144,7 @@ export function instrumentCron<T>(lib: T & CronJobConstructor, monitorSlug: stri
147144
captureException(e, {
148145
mechanism: {
149146
handled: false,
150-
type: 'cron.instrumentCron.on-tick',
151-
data: {
152-
function: 'from',
153-
},
147+
type: 'auto.function.cron.instrumentCron',
154148
},
155149
});
156150
throw e;

packages/node-core/src/cron/node-cron.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export function instrumentNodeCron<T>(lib: Partial<NodeCron> & T): T {
5656
captureException(e, {
5757
mechanism: {
5858
handled: false,
59-
type: 'cron.instrumentNodeCron',
59+
type: 'auto.function.node-cron.instrumentNodeCron',
6060
},
6161
});
6262
throw e;

0 commit comments

Comments
 (0)