From 1deb22bf63448dffc4059f6cc95ee8096581716c Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Wed, 4 Mar 2026 17:17:52 +0000 Subject: [PATCH] pagerduty --- .../notificationProviders/pagerduty.ts | 13 +++++++------ server/src/types/alert.ts | 6 ++++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/server/src/service/infrastructure/notificationProviders/pagerduty.ts b/server/src/service/infrastructure/notificationProviders/pagerduty.ts index f96ea6cc5..b15717878 100644 --- a/server/src/service/infrastructure/notificationProviders/pagerduty.ts +++ b/server/src/service/infrastructure/notificationProviders/pagerduty.ts @@ -1,15 +1,16 @@ const SERVICE_NAME = "PagerDutyProvider"; import got from "got"; -import type { Monitor, Notification, MonitorStatusResponse } from "@/types/index.js"; -import type { MonitorActionDecision } from "@/service/infrastructure/SuperSimpleQueue/SuperSimpleQueueHelper.js"; +import type { Notification } from "@/types/index.js"; import { INotificationProvider } from "@/service/index.js"; import type { NotificationMessage } from "@/types/notificationMessage.js"; import { getTestMessage } from "@/service/infrastructure/notificationProviders/utils.js"; +import { ILogger } from "@/utils/logger.js"; +import { AlertPagerDutyPayload } from "@/types/index.js"; export class PagerDutyProvider implements INotificationProvider { - private logger: any; + private logger: ILogger; - constructor(logger: any) { + constructor(logger: ILogger) { this.logger = logger; } @@ -77,7 +78,7 @@ export class PagerDutyProvider implements INotificationProvider { } } - private buildPagerDutyPayload(notification: Notification, message: NotificationMessage): any { + private buildPagerDutyPayload(notification: Notification, message: NotificationMessage): AlertPagerDutyPayload { // Map our notification type to PagerDuty event_action const eventAction = message.type === "monitor_up" || message.type === "threshold_resolved" ? "resolve" : "trigger"; @@ -106,7 +107,7 @@ export class PagerDutyProvider implements INotificationProvider { } // Build custom details - const customDetails: any = { + const customDetails: Record = { monitor_name: message.monitor.name, monitor_url: message.monitor.url, monitor_type: message.monitor.type, diff --git a/server/src/types/alert.ts b/server/src/types/alert.ts index 4725ebee8..03e88fe6a 100644 --- a/server/src/types/alert.ts +++ b/server/src/types/alert.ts @@ -4,8 +4,10 @@ export interface AlertWebhookPayload { } export interface AlertPagerDutyPayload { - routingKey: string; - monitorUrl?: string; + routing_key?: string; + dedup_key?: string; + event_action?: "trigger" | "resolve"; + payload: Record; } export interface AlertMatrixPayload {