Skip to content

Commit

Permalink
🐛 trigger alerting (#473)
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaultleouay authored Nov 14, 2023
1 parent 4d213e8 commit 5e887fc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion apps/server/src/checker/alerting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ export const triggerAlerting = async ({
monitorId,
region,
statusCode,
message,
}: {
monitorId: string;
region: keyof typeof flyRegionsDict;
statusCode: number;
statusCode?: number;
message?: string;
}) => {
console.log(`💌 triggerAlerting for ${monitorId}`);
const notifications = await db
Expand All @@ -38,6 +40,7 @@ export const triggerAlerting = async ({
notification: selectNotificationSchema.parse(notif.notification),
region: flyRegionsDict[region].location,
statusCode,
message,
});
}
};
Expand Down
3 changes: 2 additions & 1 deletion apps/server/src/checker/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ const run = async (data: Payload, retry: number) => {
await triggerAlerting({
monitorId: data.monitorId,
region: env.FLY_REGION,
statusCode: res?.status || 0,
statusCode: res?.status,
message,
});
}
}
Expand Down

0 comments on commit 5e887fc

Please sign in to comment.