From 38c884cd909d10b627519de73fd6d2711370450f Mon Sep 17 00:00:00 2001 From: Bilal Amarni Date: Wed, 16 Oct 2024 16:38:34 +0100 Subject: [PATCH] Add sampleCountMetricId to CustomAlarmThreshold This provides support for `minSampleCountToEvaluateDatapoint` when using eg. `ErrorAlarmFactory`. See https://github.com/cdklabs/cdk-monitoring-constructs/pull/466 --- lib/common/alarm/CustomAlarmThreshold.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/common/alarm/CustomAlarmThreshold.ts b/lib/common/alarm/CustomAlarmThreshold.ts index 623db0cf..a3585581 100644 --- a/lib/common/alarm/CustomAlarmThreshold.ts +++ b/lib/common/alarm/CustomAlarmThreshold.ts @@ -51,6 +51,20 @@ export interface CustomAlarmThreshold { */ readonly minSampleCountToEvaluateDatapoint?: number; + /** + * This property is required in the following situation: + *
    + *
  1. minSampleCountToEvaluateDatapoint is specified
  2. + *
  3. the metric used for the alarm is a MathExpression
  4. + *
  5. the MathExpression is composed of more than one metric
  6. + *
+ * + * In this situation, this property indicates the metric Id in the MathExpression’s usingMetrics + * 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: