mirror of
https://github.com/fosrl/pangolin.git
synced 2026-04-30 17:51:36 +00:00
Add logging when manually changing the hc status
This commit is contained in:
@@ -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}`,
|
||||
|
||||
@@ -125,6 +125,7 @@ export async function fireSiteOfflineAlert(
|
||||
healthCheck.name,
|
||||
undefined,
|
||||
undefined,
|
||||
true,
|
||||
trx
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user