Skip to content

Commit efcb15b

Browse files
sebwsLms24
authored andcommitted
add isolateTrace option to node-cron instrument
1 parent d1dd308 commit efcb15b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { captureException, withMonitor } from '@sentry/core';
1+
import { captureException, type MonitorConfig, withMonitor } from '@sentry/core';
22
import { replaceCronNames } from './common';
33

44
export interface NodeCronOptions {
@@ -32,7 +32,10 @@ export interface NodeCron {
3232
* );
3333
* ```
3434
*/
35-
export function instrumentNodeCron<T>(lib: Partial<NodeCron> & T): T {
35+
export function instrumentNodeCron<T>(
36+
lib: Partial<NodeCron> & T,
37+
monitorConfig: Pick<MonitorConfig, 'isolateTrace'> = {},
38+
): T {
3639
return new Proxy(lib, {
3740
get(target, prop) {
3841
if (prop === 'schedule' && target.schedule) {
@@ -69,6 +72,7 @@ export function instrumentNodeCron<T>(lib: Partial<NodeCron> & T): T {
6972
{
7073
schedule: { type: 'crontab', value: replaceCronNames(expression) },
7174
timezone,
75+
...monitorConfig,
7276
},
7377
);
7478
};

0 commit comments

Comments
 (0)