From e956691a39dd2217f0300b455aed5147e166e3cc Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Mon, 18 Dec 2023 22:42:45 +0100 Subject: [PATCH 01/10] feat(node): Add wrapping of `node-cron` for check-ins --- packages/node/src/checkin/node-cron.ts | 106 +++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 packages/node/src/checkin/node-cron.ts diff --git a/packages/node/src/checkin/node-cron.ts b/packages/node/src/checkin/node-cron.ts new file mode 100644 index 000000000000..9ad1a8962073 --- /dev/null +++ b/packages/node/src/checkin/node-cron.ts @@ -0,0 +1,106 @@ +import { withMonitor } from '@sentry/core'; + +interface NodeCronOptions { + name?: string; + timezone?: string; +} + +interface NodeCron { + schedule: (cronExpression: string, callback: () => void, options?: NodeCronOptions) => unknown; +} + +const replacements: [string, string][] = [ + ['january', '1'], + ['february', '2'], + ['march', '3'], + ['april', '4'], + ['may', '5'], + ['june', '6'], + ['july', '7'], + ['august', '8'], + ['september', '9'], + ['october', '10'], + ['november', '11'], + ['december', '12'], + ['jan', '1'], + ['feb', '2'], + ['mar', '3'], + ['apr', '4'], + ['may', '5'], + ['jun', '6'], + ['jul', '7'], + ['aug', '8'], + ['sep', '9'], + ['oct', '10'], + ['nov', '11'], + ['dec', '12'], + ['sunday', '0'], + ['monday', '1'], + ['tuesday', '2'], + ['wednesday', '3'], + ['thursday', '4'], + ['friday', '5'], + ['saturday', '6'], + ['sun', '0'], + ['mon', '1'], + ['tue', '2'], + ['wed', '3'], + ['thu', '4'], + ['fri', '5'], + ['sat', '6'], +]; + +function toSentryCrontab(cronExpression: string): string { + return replacements.reduce( + (acc, [name, replacement]) => acc.replace(new RegExp(name, 'gi'), replacement), + cronExpression, + ); +} + +/** + * Wraps the node-cron library with check-in monitoring. + * + * ```ts + * import * as Sentry from '@sentry/node'; + * import cron from 'node-cron'; + * + * const cronWithCheckIn = Sentry.instrumentNodeCron(cron); + * + * cronWithCheckIn.schedule('* * * * *', () => { + * console.log('running a task every minute'); + * }, + * { name: 'my-cron-job' }, + * }); + * ``` + */ +export function instrumentNodeCron(lib: Partial & T): T { + return new Proxy(lib, { + get(target, prop: keyof NodeCron) { + if (prop === 'schedule' && target.schedule) { + // When 'get' is called for schedule, return a proxied version of the schedule function + return new Proxy(target.schedule, { + apply(target, thisArg, argArray: Parameters) { + const [expression, _, options] = argArray; + + if (!options?.name) { + throw new Error('Missing "name" for scheduled job. This is required for Sentry check-in monitoring.'); + } + + return withMonitor( + options.name, + () => { + return target.apply(thisArg, argArray); + }, + { + schedule: { type: 'crontab', value: toSentryCrontab(expression) }, + timezone: options?.timezone, + }, + ); + }, + }); + } else { + return target[prop]; + } + }, + }); +} From 6f8a311dfae73ad13fce336a7ef635afd44955f4 Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Tue, 19 Dec 2023 17:05:32 +0100 Subject: [PATCH 02/10] Export as `cron` and add test --- packages/node/src/cron/index.ts | 8 ++++ .../node/src/{checkin => cron}/node-cron.ts | 22 +++++----- packages/node/src/index.ts | 1 + packages/node/test/cron.test.ts | 41 +++++++++++++++++++ 4 files changed, 62 insertions(+), 10 deletions(-) create mode 100644 packages/node/src/cron/index.ts rename packages/node/src/{checkin => cron}/node-cron.ts (84%) create mode 100644 packages/node/test/cron.test.ts diff --git a/packages/node/src/cron/index.ts b/packages/node/src/cron/index.ts new file mode 100644 index 000000000000..998c569d8736 --- /dev/null +++ b/packages/node/src/cron/index.ts @@ -0,0 +1,8 @@ +import { instrumentNodeCron } from './node-cron'; + +/** + * Methods to instrument cron libraries for Sentry check-ins. + */ +export const cron = { + instrumentNodeCron, +}; diff --git a/packages/node/src/checkin/node-cron.ts b/packages/node/src/cron/node-cron.ts similarity index 84% rename from packages/node/src/checkin/node-cron.ts rename to packages/node/src/cron/node-cron.ts index 9ad1a8962073..2cc503abafea 100644 --- a/packages/node/src/checkin/node-cron.ts +++ b/packages/node/src/cron/node-cron.ts @@ -1,11 +1,11 @@ import { withMonitor } from '@sentry/core'; -interface NodeCronOptions { +export interface NodeCronOptions { name?: string; timezone?: string; } -interface NodeCron { +export interface NodeCron { schedule: (cronExpression: string, callback: () => void, options?: NodeCronOptions) => unknown; } @@ -61,16 +61,18 @@ function toSentryCrontab(cronExpression: string): string { * Wraps the node-cron library with check-in monitoring. * * ```ts - * import * as Sentry from '@sentry/node'; - * import cron from 'node-cron'; + * import * as Sentry from "@sentry/node"; + * import cron from "node-cron"; * - * const cronWithCheckIn = Sentry.instrumentNodeCron(cron); + * const cronWithCheckIn = Sentry.cron.instrumentNodeCron(cron); * - * cronWithCheckIn.schedule('* * * * *', () => { - * console.log('running a task every minute'); + * cronWithCheckIn.schedule( + * "* * * * *", + * () => { + * console.log("running a task every minute"); * }, - * { name: 'my-cron-job' }, - * }); + * { name: "my-cron-job" }, + * ); * ``` */ export function instrumentNodeCron(lib: Partial & T): T { @@ -83,7 +85,7 @@ export function instrumentNodeCron(lib: Partial & T): T { const [expression, _, options] = argArray; if (!options?.name) { - throw new Error('Missing "name" for scheduled job. This is required for Sentry check-in monitoring.'); + throw new Error('Missing "name" for scheduled job. A name is required for Sentry check-in monitoring.'); } return withMonitor( diff --git a/packages/node/src/index.ts b/packages/node/src/index.ts index 950fe7bac197..d4feab7742e5 100644 --- a/packages/node/src/index.ts +++ b/packages/node/src/index.ts @@ -80,6 +80,7 @@ export { addRequestDataToEvent, DEFAULT_USER_INCLUDES, extractRequestData } from export { deepReadDirSync } from './utils'; export { getModuleFromFilename } from './module'; export { enableAnrDetection } from './anr'; +export { cron } from './cron'; import { Integrations as CoreIntegrations } from '@sentry/core'; diff --git a/packages/node/test/cron.test.ts b/packages/node/test/cron.test.ts new file mode 100644 index 000000000000..a1506932c549 --- /dev/null +++ b/packages/node/test/cron.test.ts @@ -0,0 +1,41 @@ +import * as SentryCore from '@sentry/core'; + +import type { NodeCron, NodeCronOptions } from '../src/cron/node-cron'; +import { instrumentNodeCron } from '../src/cron/node-cron'; + +describe('cron', () => { + let withMonitorSpy: jest.SpyInstance; + + beforeEach(() => { + withMonitorSpy = jest.spyOn(SentryCore, 'withMonitor'); + }); + + afterEach(() => { + jest.restoreAllMocks(); + }); + + test('node-cron', done => { + const nodeCron: NodeCron = { + schedule: (expression: string, callback: () => void, options?: NodeCronOptions): unknown => { + expect(expression).toBe('* * * Jan,Sep Sun'); + expect(callback).toBeInstanceOf(Function); + expect(options?.name).toBe('my-cron-job'); + return callback(); + }, + }; + + const cronWithCheckIn = instrumentNodeCron(nodeCron); + + cronWithCheckIn.schedule( + '* * * Jan,Sep Sun', + () => { + expect(withMonitorSpy).toHaveBeenCalledTimes(1); + expect(withMonitorSpy).toHaveBeenLastCalledWith('my-cron-job', expect.anything(), { + schedule: { type: 'crontab', value: '* * * 1,9 0' }, + }); + done(); + }, + { name: 'my-cron-job' }, + ); + }); +}); From 42abf2925f2cd4cad0ce2c344bbd2d1c42f62c43 Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Tue, 19 Dec 2023 17:09:48 +0100 Subject: [PATCH 03/10] add another test --- packages/node/test/cron.test.ts | 62 +++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 22 deletions(-) diff --git a/packages/node/test/cron.test.ts b/packages/node/test/cron.test.ts index a1506932c549..55669c75b765 100644 --- a/packages/node/test/cron.test.ts +++ b/packages/node/test/cron.test.ts @@ -14,28 +14,46 @@ describe('cron', () => { jest.restoreAllMocks(); }); - test('node-cron', done => { - const nodeCron: NodeCron = { - schedule: (expression: string, callback: () => void, options?: NodeCronOptions): unknown => { - expect(expression).toBe('* * * Jan,Sep Sun'); - expect(callback).toBeInstanceOf(Function); - expect(options?.name).toBe('my-cron-job'); - return callback(); - }, - }; - - const cronWithCheckIn = instrumentNodeCron(nodeCron); - - cronWithCheckIn.schedule( - '* * * Jan,Sep Sun', - () => { - expect(withMonitorSpy).toHaveBeenCalledTimes(1); - expect(withMonitorSpy).toHaveBeenLastCalledWith('my-cron-job', expect.anything(), { - schedule: { type: 'crontab', value: '* * * 1,9 0' }, + describe('node-cron', () => { + test('calls withMonitor', done => { + const nodeCron: NodeCron = { + schedule: (expression: string, callback: () => void, options?: NodeCronOptions): unknown => { + expect(expression).toBe('* * * Jan,Sep Sun'); + expect(callback).toBeInstanceOf(Function); + expect(options?.name).toBe('my-cron-job'); + return callback(); + }, + }; + + const cronWithCheckIn = instrumentNodeCron(nodeCron); + + cronWithCheckIn.schedule( + '* * * Jan,Sep Sun', + () => { + expect(withMonitorSpy).toHaveBeenCalledTimes(1); + expect(withMonitorSpy).toHaveBeenLastCalledWith('my-cron-job', expect.anything(), { + schedule: { type: 'crontab', value: '* * * 1,9 0' }, + }); + done(); + }, + { name: 'my-cron-job' }, + ); + }); + + test('throws without supplied name', () => { + const nodeCron: NodeCron = { + schedule: (): unknown => { + return undefined; + }, + }; + + const cronWithCheckIn = instrumentNodeCron(nodeCron); + + expect(() => { + cronWithCheckIn.schedule('* * * * *', () => { + // }); - done(); - }, - { name: 'my-cron-job' }, - ); + }).toThrowError('Missing "name" for scheduled job. A name is required for Sentry check-in monitoring.'); + }); }); }); From 37f4466e584930e4be2f4ae4be6e1a7548465bdf Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Tue, 19 Dec 2023 18:48:37 +0100 Subject: [PATCH 04/10] Fix broken merge --- packages/node/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/node/src/index.ts b/packages/node/src/index.ts index d4feab7742e5..6adad4593b8e 100644 --- a/packages/node/src/index.ts +++ b/packages/node/src/index.ts @@ -79,7 +79,7 @@ export { defaultIntegrations, init, defaultStackParser, getSentryRelease } from export { addRequestDataToEvent, DEFAULT_USER_INCLUDES, extractRequestData } from '@sentry/utils'; export { deepReadDirSync } from './utils'; export { getModuleFromFilename } from './module'; -export { enableAnrDetection } from './anr'; +export { enableAnrDetection, isAnrChildProcess } from './anr'; export { cron } from './cron'; import { Integrations as CoreIntegrations } from '@sentry/core'; From e6b93cd647f605da3e707d15fe1ce62c6f6c2d24 Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Tue, 19 Dec 2023 20:18:05 +0100 Subject: [PATCH 05/10] remove barrel file --- packages/node/src/cron/index.ts | 8 -------- packages/node/src/cron/node-cron.ts | 2 +- packages/node/src/index.ts | 7 ++++++- 3 files changed, 7 insertions(+), 10 deletions(-) delete mode 100644 packages/node/src/cron/index.ts diff --git a/packages/node/src/cron/index.ts b/packages/node/src/cron/index.ts deleted file mode 100644 index 998c569d8736..000000000000 --- a/packages/node/src/cron/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { instrumentNodeCron } from './node-cron'; - -/** - * Methods to instrument cron libraries for Sentry check-ins. - */ -export const cron = { - instrumentNodeCron, -}; diff --git a/packages/node/src/cron/node-cron.ts b/packages/node/src/cron/node-cron.ts index 2cc503abafea..233279c5bc7d 100644 --- a/packages/node/src/cron/node-cron.ts +++ b/packages/node/src/cron/node-cron.ts @@ -58,7 +58,7 @@ function toSentryCrontab(cronExpression: string): string { } /** - * Wraps the node-cron library with check-in monitoring. + * Wraps the `node-cron` library with check-in monitoring. * * ```ts * import * as Sentry from "@sentry/node"; diff --git a/packages/node/src/index.ts b/packages/node/src/index.ts index 6adad4593b8e..a8e06a03ad18 100644 --- a/packages/node/src/index.ts +++ b/packages/node/src/index.ts @@ -80,9 +80,14 @@ export { addRequestDataToEvent, DEFAULT_USER_INCLUDES, extractRequestData } from export { deepReadDirSync } from './utils'; export { getModuleFromFilename } from './module'; export { enableAnrDetection, isAnrChildProcess } from './anr'; -export { cron } from './cron'; + +/** Methods to instrument cron libraries for Sentry check-ins */ +export const cron = { + instrumentNodeCron, +}; import { Integrations as CoreIntegrations } from '@sentry/core'; +import { instrumentNodeCron } from './cron/node-cron'; import * as Handlers from './handlers'; import * as NodeIntegrations from './integrations'; From 150551e86ba4f3211b9156c2b04cebf6fb0cbf5b Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Tue, 19 Dec 2023 20:55:42 +0100 Subject: [PATCH 06/10] Fix tests --- packages/node/src/index.ts | 13 +++++++------ packages/node/test/cron.test.ts | 6 +++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/node/src/index.ts b/packages/node/src/index.ts index a8e06a03ad18..4fa7c71dbb8f 100644 --- a/packages/node/src/index.ts +++ b/packages/node/src/index.ts @@ -81,13 +81,7 @@ export { deepReadDirSync } from './utils'; export { getModuleFromFilename } from './module'; export { enableAnrDetection, isAnrChildProcess } from './anr'; -/** Methods to instrument cron libraries for Sentry check-ins */ -export const cron = { - instrumentNodeCron, -}; - import { Integrations as CoreIntegrations } from '@sentry/core'; -import { instrumentNodeCron } from './cron/node-cron'; import * as Handlers from './handlers'; import * as NodeIntegrations from './integrations'; @@ -102,3 +96,10 @@ const INTEGRATIONS = { export { INTEGRATIONS as Integrations, Handlers }; export { hapiErrorPlugin } from './integrations/hapi'; + +import { instrumentNodeCron } from './cron/node-cron'; + +/** Methods to instrument cron libraries for Sentry check-ins */ +export const cron = { + instrumentNodeCron, +}; diff --git a/packages/node/test/cron.test.ts b/packages/node/test/cron.test.ts index 55669c75b765..00b42b4a8379 100644 --- a/packages/node/test/cron.test.ts +++ b/packages/node/test/cron.test.ts @@ -1,7 +1,7 @@ import * as SentryCore from '@sentry/core'; +import { cron } from '../src'; import type { NodeCron, NodeCronOptions } from '../src/cron/node-cron'; -import { instrumentNodeCron } from '../src/cron/node-cron'; describe('cron', () => { let withMonitorSpy: jest.SpyInstance; @@ -25,7 +25,7 @@ describe('cron', () => { }, }; - const cronWithCheckIn = instrumentNodeCron(nodeCron); + const cronWithCheckIn = cron.instrumentNodeCron(nodeCron); cronWithCheckIn.schedule( '* * * Jan,Sep Sun', @@ -47,7 +47,7 @@ describe('cron', () => { }, }; - const cronWithCheckIn = instrumentNodeCron(nodeCron); + const cronWithCheckIn = cron.instrumentNodeCron(nodeCron); expect(() => { cronWithCheckIn.schedule('* * * * *', () => { From 1ec75865fd9eef1955c020989595e13010757d95 Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Thu, 21 Dec 2023 11:27:49 +0000 Subject: [PATCH 07/10] check assertions --- packages/node/test/cron.test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/node/test/cron.test.ts b/packages/node/test/cron.test.ts index 00b42b4a8379..a14809db3526 100644 --- a/packages/node/test/cron.test.ts +++ b/packages/node/test/cron.test.ts @@ -16,6 +16,8 @@ describe('cron', () => { describe('node-cron', () => { test('calls withMonitor', done => { + expect.assertions(5); + const nodeCron: NodeCron = { schedule: (expression: string, callback: () => void, options?: NodeCronOptions): unknown => { expect(expression).toBe('* * * Jan,Sep Sun'); From 61cc3ee01566eab2ddec13e3f029a90dd530b9d5 Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Thu, 21 Dec 2023 13:00:28 +0000 Subject: [PATCH 08/10] Move cron name replacement to common --- packages/node/src/cron/common.ts | 50 ++++++++++++++++++++++++++++ packages/node/src/cron/node-cron.ts | 51 ++--------------------------- 2 files changed, 52 insertions(+), 49 deletions(-) create mode 100644 packages/node/src/cron/common.ts diff --git a/packages/node/src/cron/common.ts b/packages/node/src/cron/common.ts new file mode 100644 index 000000000000..c710d154fdd5 --- /dev/null +++ b/packages/node/src/cron/common.ts @@ -0,0 +1,50 @@ +const replacements: [string, string][] = [ + ['january', '1'], + ['february', '2'], + ['march', '3'], + ['april', '4'], + ['may', '5'], + ['june', '6'], + ['july', '7'], + ['august', '8'], + ['september', '9'], + ['october', '10'], + ['november', '11'], + ['december', '12'], + ['jan', '1'], + ['feb', '2'], + ['mar', '3'], + ['apr', '4'], + ['may', '5'], + ['jun', '6'], + ['jul', '7'], + ['aug', '8'], + ['sep', '9'], + ['oct', '10'], + ['nov', '11'], + ['dec', '12'], + ['sunday', '0'], + ['monday', '1'], + ['tuesday', '2'], + ['wednesday', '3'], + ['thursday', '4'], + ['friday', '5'], + ['saturday', '6'], + ['sun', '0'], + ['mon', '1'], + ['tue', '2'], + ['wed', '3'], + ['thu', '4'], + ['fri', '5'], + ['sat', '6'], +]; + +/** + * Replaces names in cron expressions + */ +export function replaceCronNames(cronExpression: string): string { + return replacements.reduce( + (acc, [name, replacement]) => acc.replace(new RegExp(name, 'gi'), replacement), + cronExpression, + ); +} diff --git a/packages/node/src/cron/node-cron.ts b/packages/node/src/cron/node-cron.ts index 233279c5bc7d..ba3a3b555965 100644 --- a/packages/node/src/cron/node-cron.ts +++ b/packages/node/src/cron/node-cron.ts @@ -1,4 +1,5 @@ import { withMonitor } from '@sentry/core'; +import { replaceCronNames } from './common'; export interface NodeCronOptions { name?: string; @@ -9,54 +10,6 @@ export interface NodeCron { schedule: (cronExpression: string, callback: () => void, options?: NodeCronOptions) => unknown; } -const replacements: [string, string][] = [ - ['january', '1'], - ['february', '2'], - ['march', '3'], - ['april', '4'], - ['may', '5'], - ['june', '6'], - ['july', '7'], - ['august', '8'], - ['september', '9'], - ['october', '10'], - ['november', '11'], - ['december', '12'], - ['jan', '1'], - ['feb', '2'], - ['mar', '3'], - ['apr', '4'], - ['may', '5'], - ['jun', '6'], - ['jul', '7'], - ['aug', '8'], - ['sep', '9'], - ['oct', '10'], - ['nov', '11'], - ['dec', '12'], - ['sunday', '0'], - ['monday', '1'], - ['tuesday', '2'], - ['wednesday', '3'], - ['thursday', '4'], - ['friday', '5'], - ['saturday', '6'], - ['sun', '0'], - ['mon', '1'], - ['tue', '2'], - ['wed', '3'], - ['thu', '4'], - ['fri', '5'], - ['sat', '6'], -]; - -function toSentryCrontab(cronExpression: string): string { - return replacements.reduce( - (acc, [name, replacement]) => acc.replace(new RegExp(name, 'gi'), replacement), - cronExpression, - ); -} - /** * Wraps the `node-cron` library with check-in monitoring. * @@ -94,7 +47,7 @@ export function instrumentNodeCron(lib: Partial & T): T { return target.apply(thisArg, argArray); }, { - schedule: { type: 'crontab', value: toSentryCrontab(expression) }, + schedule: { type: 'crontab', value: replaceCronNames(expression) }, timezone: options?.timezone, }, ); From 119672000e978d621512e37eb3f629ca99dd80c1 Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Wed, 3 Jan 2024 16:49:10 +0100 Subject: [PATCH 09/10] Export from downstream packages --- packages/astro/src/index.server.ts | 1 + packages/bun/src/index.ts | 2 +- packages/node/test/cron.test.ts | 2 +- packages/remix/src/index.server.ts | 1 + packages/sveltekit/src/server/index.ts | 1 + 5 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/astro/src/index.server.ts b/packages/astro/src/index.server.ts index 5dd9f1047431..04d00134880b 100644 --- a/packages/astro/src/index.server.ts +++ b/packages/astro/src/index.server.ts @@ -66,6 +66,7 @@ export { startInactiveSpan, startSpanManual, continueTrace, + cron, } from '@sentry/node'; // We can still leave this for the carrier init and type exports diff --git a/packages/bun/src/index.ts b/packages/bun/src/index.ts index bc29dcd908b5..215f91e2cdd8 100644 --- a/packages/bun/src/index.ts +++ b/packages/bun/src/index.ts @@ -73,7 +73,7 @@ export { metrics, } from '@sentry/core'; export type { SpanStatusType } from '@sentry/core'; -export { autoDiscoverNodePerformanceMonitoringIntegrations } from '@sentry/node'; +export { autoDiscoverNodePerformanceMonitoringIntegrations, cron } from '@sentry/node'; export { BunClient } from './client'; export { defaultIntegrations, init } from './sdk'; diff --git a/packages/node/test/cron.test.ts b/packages/node/test/cron.test.ts index 55aba01d8759..3c8bb1a66a4c 100644 --- a/packages/node/test/cron.test.ts +++ b/packages/node/test/cron.test.ts @@ -4,7 +4,7 @@ import { cron } from '../src'; import type { CronJob, CronJobParams } from '../src/cron/cron'; import type { NodeCron, NodeCronOptions } from '../src/cron/node-cron'; -describe('cron', () => { +describe('cron check-ins', () => { let withMonitorSpy: jest.SpyInstance; beforeEach(() => { diff --git a/packages/remix/src/index.server.ts b/packages/remix/src/index.server.ts index 785285ecdaf1..6d4d9fee5626 100644 --- a/packages/remix/src/index.server.ts +++ b/packages/remix/src/index.server.ts @@ -57,6 +57,7 @@ export { deepReadDirSync, Integrations, Handlers, + cron, } from '@sentry/node'; // Keeping the `*` exports for backwards compatibility and types diff --git a/packages/sveltekit/src/server/index.ts b/packages/sveltekit/src/server/index.ts index 16556479511e..a7395e3cfb18 100644 --- a/packages/sveltekit/src/server/index.ts +++ b/packages/sveltekit/src/server/index.ts @@ -63,6 +63,7 @@ export { startInactiveSpan, startSpanManual, continueTrace, + cron, } from '@sentry/node'; // We can still leave this for the carrier init and type exports From 8fdb9035081d742e04e74899f9a992f2fcde9b0c Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Wed, 3 Jan 2024 16:52:11 +0100 Subject: [PATCH 10/10] disable lint --- packages/node/src/cron/common.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/node/src/cron/common.ts b/packages/node/src/cron/common.ts index c710d154fdd5..0fa8c1c18d23 100644 --- a/packages/node/src/cron/common.ts +++ b/packages/node/src/cron/common.ts @@ -44,6 +44,7 @@ const replacements: [string, string][] = [ */ export function replaceCronNames(cronExpression: string): string { return replacements.reduce( + // eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor (acc, [name, replacement]) => acc.replace(new RegExp(name, 'gi'), replacement), cronExpression, );