Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d25bcb6

Browse files
committed
ref(node-core): Add mechanism to cron instrumentations
1 parent af69b45 commit d25bcb6

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

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

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,15 @@ export function instrumentCron<T>(lib: T & CronJobConstructor, monitorSlug: stri
9999
try {
100100
await onTick(context, onComplete);
101101
} catch (e) {
102-
captureException(e);
102+
captureException(e, {
103+
mechanism: {
104+
handled: false,
105+
type: 'cron.instrumentCron',
106+
data: {
107+
function: 'constructor',
108+
},
109+
},
110+
});
103111
throw e;
104112
}
105113
},
@@ -136,7 +144,15 @@ export function instrumentCron<T>(lib: T & CronJobConstructor, monitorSlug: stri
136144
try {
137145
await onTick(context, onComplete);
138146
} catch (e) {
139-
captureException(e);
147+
captureException(e, {
148+
mechanism: {
149+
handled: false,
150+
type: 'cron.instrumentCron.on-tick',
151+
data: {
152+
function: 'from',
153+
},
154+
},
155+
});
140156
throw e;
141157
}
142158
},

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@ export function instrumentNodeCron<T>(lib: Partial<NodeCron> & T): T {
5353
try {
5454
return await callback();
5555
} catch (e) {
56-
captureException(e);
56+
captureException(e, {
57+
mechanism: {
58+
handled: false,
59+
type: 'cron.instrumentNodeCron',
60+
},
61+
});
5762
throw e;
5863
}
5964
},

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /