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.
2.4 kB ยท 94 lines
TypeScript
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495import type { PrivateLocation } from "@openstatus/db/src/schema";import { Alert, Success, Failed, Send, Incident } from "@openstatus/icons";import { getRegionInfo } from "@openstatus/regions";
import { formatMilliseconds } from "@/lib/formatter";
export const config = { "incident.created": { icon: Incident, color: "text-destructive", title: "Incident Created", }, "incident.resolved": { icon: Success, color: "text-success", title: "Incident Resolved", }, "monitor.failed": { icon: Failed, color: "text-destructive", title: "Monitor Failed", }, "notification.sent": { icon: Send, color: "text-info", title: "Notification Sent", }, "monitor.recovered": { icon: Success, color: "text-success", title: "Monitor Recovered", }, "monitor.degraded": { icon: Alert, color: "text-warning", title: "Monitor Degraded", },} as const;
export const getMetadata = (privateLocations?: PrivateLocation[]) => { return { region: { label: "Region", key: "region", unit: undefined, visible: () => true, format: (value) => { const regionInfo = getRegionInfo(`${value}`, { location: privateLocations?.find( (location) => String(location.id) === String(value), )?.name, }); return `${regionInfo.location} (${regionInfo.provider})`; }, }, cronTimestamp: { label: "Timestamp", key: "timestamp", unit: undefined, visible: () => false, format: (value) => String(value), }, statusCode: { label: "Status Code", key: "status", unit: undefined, visible: (_value) => typeof _value === "number" && _value !== -1, format: (value) => String(value), }, latency: { label: "Latency", key: "latency", unit: "ms", visible: () => true, format: (value) => formatMilliseconds(Number(value)), }, provider: { label: "Provider", key: "provider", unit: undefined, visible: () => true, format: (value) => String(value), }, } as const satisfies Record< string, { label: string; key: string; unit?: string | undefined; visible: (value: string | number) => boolean; format: (value: string | number) => string; } >;};