-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(dynamodb): Misconfigured metrics causing empty graphs (#11283)
This PR corrects 3 misconfigured metrics we had on the `Table` construct. ### UserErrors Per the [documentation](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/metrics-dimensions.html) The `table.metricUserErrors()` does not emit the `TableName` dimension. It is actually an account (and region) wide metric. The fix was to remove the `TableName` dimensionality from the metric creation. ### SystemErrors Per the [documentation](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/metrics-dimensions.html) The `table.metricSystemErrors()` is always emitted with the `Operation` dimension, and our current implementation does not pass it. The fix adds an additional `operations` property to the method, that allows passing an array of operations, the returned metric will be a *SUM* over those operations. If no operation is passed, we sum all available operations. Since the current method returns a `Metric`, returning a math expression won't work since it is an `IMetric` that doesn't extend `Metric`. To avoid breaking changes, we introduce a new method, `metricSystemErrorsForOperations`: ```ts const totalSystemErrors = table.metricSystemErrorsForOperations(); const getPutSystemErrors = table.metricSystemErrorsForOperations({ operations: [dynamo.Operation.PUT_ITEM, dynamo.Operation.GET_ITEM] }); ``` ### SuccessfulRequestLatency Per the [documentation](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/metrics-dimensions.html) The `table.metricSuccessfulRequestLatency()` is always emitted with the `Operation` dimension, and our current implementation does not pass it. The fix requires user to pass the `Operation` dimension. So the API is: ```ts const getLatency = table.metricSuccessfulRequestLatency({ dimensions: { Operation: 'GetItem' }, }); ``` Fixes #11261 Fixes #11269 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
Showing
4 changed files
with
362 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.