Skip to content

Commit c51016a

Browse files
authored
feat: add max iterator age for Lambda (#144)
Fixes #134 --- _By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license_
1 parent ba04ec8 commit c51016a

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

lib/monitoring/aws-lambda/LambdaFunctionMonitoring.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import {
3737
ThirdWidth,
3838
TimeAxisMillisFromZero,
3939
TpsAlarmFactory,
40-
TwoThirdsWidth,
4140
UsageAlarmFactory,
4241
UsageThreshold,
4342
UsageType,
@@ -129,6 +128,7 @@ export class LambdaFunctionMonitoring extends Monitoring {
129128
protected readonly tpsAnnotations: HorizontalAnnotation[];
130129
protected readonly cpuTotalTimeAnnotations: HorizontalAnnotation[];
131130
protected readonly memoryUsageAnnotations: HorizontalAnnotation[];
131+
protected readonly maxIteratorAgeAnnotations: HorizontalAnnotation[];
132132

133133
protected readonly tpsMetric: MetricWithAlarmSupport;
134134
protected readonly p50LatencyMetric: MetricWithAlarmSupport;
@@ -186,6 +186,7 @@ export class LambdaFunctionMonitoring extends Monitoring {
186186
this.tpsAnnotations = [];
187187
this.cpuTotalTimeAnnotations = [];
188188
this.memoryUsageAnnotations = [];
189+
this.maxIteratorAgeAnnotations = [];
189190

190191
this.metricFactory = new LambdaFunctionMetricFactory(
191192
scope.createMetricFactory(),
@@ -456,6 +457,7 @@ export class LambdaFunctionMonitoring extends Monitoring {
456457
alarmProps,
457458
disambiguator
458459
);
460+
this.maxIteratorAgeAnnotations.push(createdAlarm.annotation);
459461
this.addAlarm(createdAlarm);
460462
}
461463

@@ -481,7 +483,8 @@ export class LambdaFunctionMonitoring extends Monitoring {
481483
this.createRateWidget(QuarterWidth, DefaultGraphWidgetHeight)
482484
),
483485
new Row(
484-
this.createInvocationWidget(TwoThirdsWidth, DefaultGraphWidgetHeight),
486+
this.createInvocationWidget(ThirdWidth, DefaultGraphWidgetHeight),
487+
this.createIteratorAgeWidget(ThirdWidth, DefaultGraphWidgetHeight),
485488
this.createErrorCountWidget(ThirdWidth, DefaultGraphWidgetHeight)
486489
),
487490
];
@@ -594,6 +597,17 @@ export class LambdaFunctionMonitoring extends Monitoring {
594597
});
595598
}
596599

600+
protected createIteratorAgeWidget(width: number, height: number) {
601+
return new GraphWidget({
602+
width,
603+
height,
604+
title: "Iterator",
605+
left: [this.maxIteratorAgeMetric],
606+
leftYAxis: TimeAxisMillisFromZero,
607+
leftAnnotations: this.maxIteratorAgeAnnotations,
608+
});
609+
}
610+
597611
protected createLambdaInsightsCpuWidget(width: number, height: number) {
598612
return new GraphWidget({
599613
width,

test/facade/__snapshots__/MonitoringAspect.test.ts.snap

Lines changed: 10 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)