Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/openstatusHQ/openstatus. ๐ซ Status page with uptime monitoring & API monitoring as code ๐ซ openstatus.dev
bun drizzle-orm monitoring monitoring-as-code nextjs observability on-call open-source shadcn-ui status-page statuspage synthetic-monitoring tinybird turso uptime uptime-checker uptime-monitor
Something went wrong. Try again.
1.4 kB ยท 55 lines
TypeScript
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556import { FetchError } from "@openstatus/status-fetcher";import * as Sentry from "@sentry/deno";
import { env } from "../env";
Sentry.init({ dsn: env().SENTRY_DSN, environment: env().NODE_ENV, tracesSampleRate: 0,});
export function runSentryCron(monitorSlug: string): { cronCompleted: () => Promise<void>; cronFailed: () => Promise<void>;} { const checkInId = Sentry.captureCheckIn({ monitorSlug, status: "in_progress", }); return { cronCompleted: async () => { Sentry.captureCheckIn({ checkInId, monitorSlug, status: "ok" }); await Sentry.flush(); }, cronFailed: async () => { Sentry.captureCheckIn({ checkInId, monitorSlug, status: "error" }); await Sentry.flush(); }, };}
export async function reportBackgroundError(message: string): Promise<void> { Sentry.captureMessage(message, "error"); await Sentry.flush();}
// Fires inside the per-service fetch loop, so no flush here โ the tick's// cronCompleted/cronFailed path flushes once the tick settles.export function reportFetchFailure(args: { phase: "status" | "incidents" | "components"; slug: string; error: FetchError;}): void { const { phase, slug, error } = args; Sentry.captureException(error, { tags: { cron: "external-status", phase, slug, fetcher: error.fetcherName ?? "unknown", http_status: error.httpStatus, }, extra: { url: error.url }, });}