Skip to content

Commit 6bd7215

Browse files
feat: Enable configuration of evaluation periods in watchLambdaFunction (cdklabs#1182)
1 parent c48a4dc commit 6bd7215

File tree

2 files changed

+31
-9
lines changed

2 files changed

+31
-9
lines changed

API.md

+12-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lambda.ts

+19-5
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,25 @@ export interface WatchLambdaFunctionOptions {
3333
readonly durationThresholdPercent?: number;
3434

3535
/**
36-
* Number of periods to evaluate for the alarms.
36+
* Number of periods to evaluate for the errors alarms.
3737
*
3838
* @default 3
3939
*/
40-
readonly evaluationPeriods?: number;
40+
readonly errorsEvaluationPeriods?: number;
41+
42+
/**
43+
* Number of periods to evaluate for the throttles alarms.
44+
*
45+
* @default 3
46+
*/
47+
readonly throttlesEvaluationPeriods?: number;
48+
49+
/**
50+
* Number of periods to evaluate for the duration alarms.
51+
*
52+
* @default 3
53+
*/
54+
readonly durationEvaluationPeriods?: number;
4155
}
4256

4357
export interface WatchLambdaFunctionProps extends WatchLambdaFunctionOptions {
@@ -70,16 +84,16 @@ export class WatchLambdaFunction extends Construct {
7084

7185
const { errorsMetric, errorsAlarm } = this.createErrorsMonitor(
7286
props.errorsPerMinuteThreshold,
73-
props.evaluationPeriods,
87+
props.errorsEvaluationPeriods,
7488
);
7589
const { throttlesMetric, throttlesAlarm } = this.createThrottlesMonitor(
7690
props.throttlesPerMinuteThreshold,
77-
props.evaluationPeriods,
91+
props.throttlesEvaluationPeriods,
7892
);
7993
const { durationMetric, durationAlarm } = this.createDurationMonitor(
8094
timeoutSec,
8195
props.durationThresholdPercent,
82-
props.evaluationPeriods,
96+
props.durationEvaluationPeriods,
8397
);
8498
const invocationsMetric = this.metrics.metricInvocations(
8599
this.fn.functionName,

0 commit comments

Comments
 (0)