Skip to content

Commit dc84325

Browse files
author
Eugene Cheung
authored
fix(dynamo): limit metricSystemErrorsCount to previously defined operations (#96)
Fixes #48 This should unblock the CDK v2 upgrade. If we want to support the other operations, we can add more metrics/alarms configurations for those. --- _By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license_
1 parent e413724 commit dc84325

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

API.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37995,7 +37995,9 @@ public metricSystemErrorsCount(): Metric | MathExpression
3799537995

3799637996
This represents the number of requests that resulted in a 500 (server error) error code.
3799737997

37998-
It summarizes across all operations.
37998+
It summarizes across the basic CRUD operations:
37999+
GetItem, BatchGetItem, Scan, Query, GetRecords, PutItem, DeleteItem, UpdateItem, BatchWriteItem
38000+
3799938001
It’s usually equal to zero.
3800038002

3800138003
##### `metricThrottledReadRequestCount` <a name="metricThrottledReadRequestCount" id="cdk-monitoring-constructs.DynamoTableMetricFactory.metricThrottledReadRequestCount"></a>

lib/monitoring/aws-dynamo/DynamoTableMetricFactory.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,26 @@ export class DynamoTableMetricFactory {
148148

149149
/**
150150
* This represents the number of requests that resulted in a 500 (server error) error code.
151-
* It summarizes across all operations.
151+
* It summarizes across the basic CRUD operations:
152+
* GetItem, BatchGetItem, Scan, Query, GetRecords, PutItem, DeleteItem, UpdateItem, BatchWriteItem
153+
*
152154
* It’s usually equal to zero.
153155
*/
154156
metricSystemErrorsCount() {
155-
const allOperations = Object.values(Operation);
157+
const crudOperations = [
158+
Operation.GET_ITEM,
159+
Operation.BATCH_GET_ITEM,
160+
Operation.SCAN,
161+
Operation.QUERY,
162+
Operation.GET_RECORDS,
163+
Operation.PUT_ITEM,
164+
Operation.DELETE_ITEM,
165+
Operation.UPDATE_ITEM,
166+
Operation.BATCH_WRITE_ITEM,
167+
];
156168
const usingMetrics: Record<string, IMetric> = {};
157169

158-
allOperations.forEach((operation) => {
170+
crudOperations.forEach((operation) => {
159171
const metric = this.table.metric("SystemErrors", {
160172
dimensions: { TableName: this.table.tableName, Operation: operation },
161173
statistic: MetricStatistic.SUM,

0 commit comments

Comments
 (0)