Skip to content

Commit 3bc0ee4

Browse files
committed
feat(monitoring): weekly canary cron to verify Sentry alerting chain
1 parent 5bb851a commit 3bc0ee4

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

src/app.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ declare global {
1919
SENTRY_DSN?: string;
2020
};
2121
}
22-
}
22+
// Cloudflare Workers Cron Trigger handler signature.
23+
type Scheduled = (event: { platform: Platform | undefined }) => Promise<void>;
24+
}
2325
}
2426

2527
export {};

src/hooks.server.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,4 +198,16 @@ export const handle: Handle = async ({ event, resolve }) => {
198198
return securedResponse;
199199
};
200200

201+
// Weekly canary: fires every Monday 9am UTC (see wrangler.toml).
202+
// Sends a test event to Sentry to verify the full alerting chain is working.
203+
export const scheduled: App.Scheduled = async ({ platform }) => {
204+
const dsn = platform?.env?.SENTRY_DSN;
205+
if (!dsn) return;
206+
await captureToSentry(dsn, {
207+
level: 'info',
208+
message: 'Weekly canary — alerting system is working',
209+
});
210+
console.log('[canary] sent weekly test event to Sentry');
211+
};
212+
201213

wrangler.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ migrations_dir = "migrations"
1919

2020
[vars]
2121
APP_URL = "https://openboot.dev"
22+
23+
[triggers]
24+
crons = ["0 9 * * 1"] # every Monday 9am UTC — canary alert test

0 commit comments

Comments
 (0)