Skip to content

Open-source status page, incident response and uptime monitoring

πŸ› alerting (#1022)

Thibault Le Ouaye715415b8089
diff --git a/apps/server/src/checker/alerting.test.ts b/apps/server/src/checker/alerting.test.ts
index 3b186b4eb..c03f0fe48 100644
--- a/apps/server/src/checker/alerting.test.ts
+++ b/apps/server/src/checker/alerting.test.ts
@@ -15,6 +15,8 @@ test.todo("should send email notification", async () => {
monitorId: "1",
statusCode: 400,
notifType: "alert",
+ cronTimestamp: 123456,
+ incidentId: "1",
});
expect(fn).toHaveBeenCalled();
});
diff --git a/apps/server/src/checker/alerting.ts b/apps/server/src/checker/alerting.ts
index 16cafd13f..0eb724a96 100644
--- a/apps/server/src/checker/alerting.ts
+++ b/apps/server/src/checker/alerting.ts
@@ -25,7 +25,7 @@ export const triggerNotifications = async ({
message?: string;
notifType: "alert" | "recovery" | "degraded";
cronTimestamp: number;
- incidentId?: string;
+ incidentId: string;
}) => {
console.log(`πŸ’Œ triggerAlerting for ${monitorId}`);
const notifications = await db
diff --git a/apps/server/src/checker/index.ts b/apps/server/src/checker/index.ts
index d183b1fd9..de13d2f79 100644
--- a/apps/server/src/checker/index.ts
+++ b/apps/server/src/checker/index.ts
@@ -102,6 +102,7 @@ checkerRoute.post("/updateStatus", async (c) => {
message,
notifType: "degraded",
cronTimestamp,
+ incidentId: `${cronTimestamp}`,
});
}
}
@@ -178,6 +179,7 @@ checkerRoute.post("/updateStatus", async (c) => {
message,
notifType: "alert",
cronTimestamp,
+ incidentId: String(newIncident[0].id),
});
if (newIncident.length > 0) {
@@ -268,6 +270,7 @@ checkerRoute.post("/updateStatus", async (c) => {
message,
notifType: "recovery",
cronTimestamp,
+ incidentId: String(incident.id),
});
const monitor = await db