import * as cdk from "aws-cdk-lib"; import type { IAlarmAction } from "aws-cdk-lib/aws-cloudwatch"; import * as cloudwatch from "aws-cdk-lib/aws-cloudwatch"; import * as constructs from "constructs"; export interface QueueAlarmsProps { alarmAction: cloudwatch.IAlarmAction; warningAction: cloudwatch.IAlarmAction; queueName: string; } /** * This construct provides a thin wrapper that creates two alarms for * SQS queues. * * Unlike RDS and ECS alarm constructs in this package, `QueueAlarms` is * set up manually by consumers (it doesn't auto-wire to resources). * * Defaults: * - Messages-not-being-processed alarm -> sent to `alarmAction` by default * - Approximate-age alarm -> sent to `warningAction` by default */ export declare class QueueAlarms extends constructs.Construct { private readonly alarmAction; private readonly warningAction; private readonly queueName; constructor(scope: constructs.Construct, id: string, props: QueueAlarmsProps); /** * Sets up a CloudWatch Composite Alarm that triggers if messages are not being deleted * from queue, and there are visible messages on the queue. */ addMessagesNotBeingProcessedAlarm(props?: { /** * Period for metric evaluation as a CDK Duration * @default cdk.Duration.seconds(300) */ period?: cdk.Duration; /** * Evaluation periods for MessagesVisible metric * @default 2 */ evaluationPeriodsMessagesVisible?: number; /** * Threshold for MessagesVisible metric (minimum) * @default 1 */ thresholdMessagesVisible?: number; /** * Evaluation periods for NumberOfMessagesDeleted metric * @default 4 */ evaluationPeriodsMessagesDeleted?: number; /** * Threshold for NumberOfMessagesDeleted (sum) * @default 0 */ thresholdMessagesDeleted?: number; /** * @default true */ enableOkAlarm?: boolean; /** Per-alarm override of the action to use instead of the construct alarmAction */ action?: IAlarmAction; }): void; /** * Alerts when the ApproximateAgeOfOldestMessage metric is high. */ addApproximateAgeOfOldestMessageAlarm(props?: { alarmDescription?: string; /** * @default cdk.Duration.seconds(900) (15 minutes) */ period?: cdk.Duration; /** * @default 2 */ evaluationPeriods?: number; /** * Threshold in seconds for the age of the oldest message * @default 900 seconds (15 minutes) */ thresholdSeconds?: number; /** * @default false */ enableOkAlarm?: boolean; /** An action to use for CloudWatch alarm state changes instead of the default warningAction */ action?: IAlarmAction; }): void; /** * Alerts when too many messages exist on the queue. */ addTooManyMessagesExistAlarm(props: { /** * Maximum number of visible messages before triggering the alarm */ messageAmountLimit: number; alarmDescription?: string; /** * @default cdk.Duration.seconds(60) */ period?: cdk.Duration; /** * @default 5 */ evaluationPeriods?: number; /** * @default true */ enableOkAlarm?: boolean; /** An action to use for CloudWatch alarm state changes instead of the default warningAction */ action?: IAlarmAction; }): void; }