Skip to content

Open-source status page, incident response and uptime monitoring

Improve error handling (#1213)

Thibault Le Ouay6bf8d47e05f3
diff --git a/apps/workflows/src/checker/index.ts b/apps/workflows/src/checker/index.ts
index 7588f329a..8cb0eeb38 100644
--- a/apps/workflows/src/checker/index.ts
+++ b/apps/workflows/src/checker/index.ts
@@ -84,8 +84,8 @@ checkerRoute.post("/updateStatus", async (c) => {
.where(
and(
eq(schema.monitorStatusTable.monitorId, monitor.id),
- eq(schema.monitorStatusTable.status, status)
- )
+ eq(schema.monitorStatusTable.status, status),
+ ),
)
.get();
@@ -103,8 +103,8 @@ checkerRoute.post("/updateStatus", async (c) => {
and(
eq(incidentTable.monitorId, Number(monitorId)),
isNull(incidentTable.resolvedAt),
- isNull(incidentTable.acknowledgedAt)
- )
+ isNull(incidentTable.acknowledgedAt),
+ ),
)
.get();
@@ -138,6 +138,8 @@ checkerRoute.post("/updateStatus", async (c) => {
message,
notifType: "recovery",
cronTimestamp,
+ region,
+ latency,
incidentId: `${cronTimestamp}`,
});
@@ -153,7 +155,7 @@ checkerRoute.post("/updateStatus", async (c) => {
case "degraded":
if (monitor.status !== "degraded") {
console.log(
- `πŸ”„ update monitorStatus ${monitor.id} status: DEGRADED}`
+ `πŸ”„ update monitorStatus ${monitor.id} status: DEGRADED}`,
);
await db
.update(schema.monitor)
@@ -167,6 +169,7 @@ checkerRoute.post("/updateStatus", async (c) => {
notifType: "degraded",
cronTimestamp,
latency,
+ region,
incidentId: `${cronTimestamp}`,
});
}
@@ -197,6 +200,8 @@ checkerRoute.post("/updateStatus", async (c) => {
message,
notifType: "alert",
cronTimestamp,
+ latency,
+ region,
incidentId: String(newIncident[0].id),
});
diff --git a/apps/workflows/src/cron/monitor.ts b/apps/workflows/src/cron/monitor.ts
index 6d729399c..0e0bc1c8a 100644
--- a/apps/workflows/src/cron/monitor.ts
+++ b/apps/workflows/src/cron/monitor.ts
@@ -288,6 +288,7 @@ export async function StepPaused(userId: number, workFlowRunTimestamp: number) {
.get();
// We should only have one user :)
if (!users) {
+ console.log(`No user found for ${userId}`);
throw new Error("Too many users found");
}