import { Duration } from "aws-cdk-lib"; import { ComparisonOperator, TreatMissingData } from "aws-cdk-lib/aws-cloudwatch"; import { IAlarmActionStrategy } from "./action"; import { IMetricAdjuster } from "./metric-adjuster"; /** * Common customization that can be attached to each alarm. */ export interface CustomAlarmThreshold { /** * Allows to override the default alarm action. * * @default - undefined (default action will be used, if any) */ readonly actionOverride?: IAlarmActionStrategy; /** * If this is defined, the alarm dedupe string is set to this exact value. * Please be aware that you need to handle deduping for different stages (Beta, Prod...) and regions (EU, NA...) manually. * * @default - undefined (no override) */ readonly dedupeStringOverride?: string; /** * If this is defined, the alarm name is set to this exact value. * Please be aware that you need to specify prefix for different stages (Beta, Prod...) and regions (EU, NA...) manually. */ readonly alarmNameOverride?: string; /** * A text included in the generated ticket description body, which fully replaces the generated text. * * @default - default auto-generated content only */ readonly alarmDescriptionOverride?: string; /** * If this is defined, the default resource-specific alarm dedupe string will be set and this will be added as a suffix. * This allows you to specify the same dedupe string for a family of alarms. * Cannot be defined at the same time as dedupeStringOverride. * * @default - undefined (no suffix) */ readonly alarmDedupeStringSuffix?: string; /** * Specifies how many samples (N) of the metric is needed in a datapoint to be evaluated for alarming. * If this property is specified, your metric will be subject to MathExpression that will add an IF condition * to your metric to make sure that each datapoint is evaluated only if it has sufficient number of samples. * If the number of samples is not sufficient, the datapoint will be treated as missing data and will be evaluated * according to the treatMissingData parameter. * If specified, deprecated minMetricSamplesToAlarm has no effect. * * @default - default behaviour - no condition on sample count will be used */ readonly minSampleCountToEvaluateDatapoint?: number; /** * This property is required in the following situation: *
minSampleCountToEvaluateDatapoint is specifiedMathExpressionMathExpression is composed of more than one metricusingMetrics
* property that should be used as the sampleCount metric for the new MathExpression as described in the documentation
* for minSampleCountToEvaluateDatapoint.
*/
readonly sampleCountMetricId?: string;
/**
* Specifies how many samples (N) of the metric is needed to trigger the alarm.
* If this property is specified, a composite alarm is created of the following:
* false, the alarm state does not change during periods with too few data points to be statistically significant.
* If you specify true, the alarm is always evaluated and possibly changes state no matter how many data points are available.
*
* @default - true
*/
readonly evaluateLowSampleCountPercentile?: boolean;
/**
* Enables the configured CloudWatch alarm ticketing actions.
*
* @default - the same as monitoring facade default
*/
readonly actionsEnabled?: boolean;
/**
* Number of breaches required to transition into an ALARM state.
*
* @default - the same as monitoring facade default
*/
readonly datapointsToAlarm?: number;
/**
* Number of periods to consider when checking the number of breaching datapoints.
*
* @default - the same as monitoring facade default
*/
readonly evaluationPeriods?: number;
/**
* Period override for the metric to alarm on.
*
* @default - the default specified in MetricFactory
*/
readonly period?: Duration;
/**
* An optional link included in the generated ticket description body.
*
* @default - no additional link will be added
*/
readonly documentationLink?: string;
/**
* An optional link included in the generated ticket description body.
*
* @default - no additional link will be added
*/
readonly runbookLink?: string;
/**
* Indicates whether the alarming range of values should be highlighted in the widget.
*
* @default - false
*/
readonly fillAlarmRange?: boolean;
/**
* If specified, it modifies the final alarm annotation color.
*
* @default - no override (default color)
*/
readonly overrideAnnotationColor?: string;
/**
* If specified, it modifies the final alarm annotation label.
*
* @default - no override (default label)
*/
readonly overrideAnnotationLabel?: string;
/**
* If specified, it modifies the final alarm annotation visibility.
*
* @default - no override (default visibility)
*/
readonly overrideAnnotationVisibility?: boolean;
/**
* If specified, adjusts the metric before creating an alarm from it.
*
* @default - no adjuster
*/
readonly metricAdjuster?: IMetricAdjuster;
}