Add logging when manually changing the hc status

This commit is contained in:
Owen
2026-04-26 17:28:57 -07:00
parent 06af53c4d6
commit ca2370e31d
21 changed files with 170 additions and 45 deletions

View File

@@ -50,7 +50,8 @@ export async function fireHealthCheckHealthyAlert(
healthCheckName?: string | null,
healthCheckTargetId?: number | null,
extra?: Record<string, unknown>,
trx: Transaction | typeof db = db
send: boolean = true,
trx: Transaction | typeof db = db,
): Promise<void> {
try {
await trx.insert(statusHistory).values({
@@ -63,6 +64,10 @@ export async function fireHealthCheckHealthyAlert(
await handleResource(orgId, healthCheckTargetId, trx);
if (!send) {
return;
}
await processAlerts({
eventType: "health_check_healthy",
orgId,
@@ -108,6 +113,7 @@ export async function fireHealthCheckUnhealthyAlert(
healthCheckName?: string | null,
healthCheckTargetId?: number | null,
extra?: Record<string, unknown>,
send: boolean = true,
trx: Transaction | typeof db = db
): Promise<void> {
try {
@@ -121,6 +127,10 @@ export async function fireHealthCheckUnhealthyAlert(
await handleResource(orgId, healthCheckTargetId, trx);
if (!send) {
return;
}
await processAlerts({
eventType: "health_check_unhealthy",
orgId,
@@ -155,6 +165,7 @@ export async function fireHealthCheckUnknownAlert(
healthCheckName?: string | null,
healthCheckTargetId?: number | null,
extra?: Record<string, unknown>,
send: boolean = true,
trx: Transaction | typeof db = db
): Promise<void> {
try {
@@ -167,6 +178,10 @@ export async function fireHealthCheckUnknownAlert(
});
await handleResource(orgId, healthCheckTargetId, trx);
if (!send) {
return;
}
} catch (err) {
logger.error(
`fireHealthCheckUnknownAlert: unexpected error for healthCheckId ${healthCheckId}`,

View File

@@ -125,6 +125,7 @@ export async function fireSiteOfflineAlert(
healthCheck.name,
undefined,
undefined,
true,
trx
);
}