From 27b0e87964ac23b57ed26f40d6b89c02c1d8218d Mon Sep 17 00:00:00 2001 From: Stephan Huber Date: Tue, 23 Aug 2022 12:34:53 +0200 Subject: [PATCH 1/2] improv(metrics): Add support to 30 dimensions --- packages/metrics/src/Metrics.ts | 2 +- packages/metrics/tests/unit/Metrics.test.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/metrics/src/Metrics.ts b/packages/metrics/src/Metrics.ts index 39a0d09ecd..429e8a7d54 100644 --- a/packages/metrics/src/Metrics.ts +++ b/packages/metrics/src/Metrics.ts @@ -14,7 +14,7 @@ import { } from './types'; const MAX_METRICS_SIZE = 100; -const MAX_DIMENSION_COUNT = 9; +const MAX_DIMENSION_COUNT = 29; const DEFAULT_NAMESPACE = 'default_namespace'; /** diff --git a/packages/metrics/tests/unit/Metrics.test.ts b/packages/metrics/tests/unit/Metrics.test.ts index bb59bde57a..345306714e 100644 --- a/packages/metrics/tests/unit/Metrics.test.ts +++ b/packages/metrics/tests/unit/Metrics.test.ts @@ -13,7 +13,7 @@ import { Metrics, MetricUnits } from '../../src/'; import { populateEnvironmentVariables } from '../helpers'; const MAX_METRICS_SIZE = 100; -const MAX_DIMENSION_COUNT = 9; +const MAX_DIMENSION_COUNT = 29; const DEFAULT_NAMESPACE = 'default_namespace'; const consoleSpy = jest.spyOn(console, 'log').mockImplementation(); @@ -371,7 +371,7 @@ describe('Class: Metrics', () => { } }); - test('Error should be thrown on empty metrics when throwOnEmptyMetrics() is callse', async () => { + test('Error should be thrown on empty metrics when throwOnEmptyMetrics() is called', async () => { expect.assertions(1); const metrics = new Metrics({ namespace: 'test' }); @@ -459,6 +459,7 @@ describe('Class: Metrics', () => { }); test('Should throw an error if the same metric name is added again with a different unit', ()=> { + expect.assertions(1); const metrics = new Metrics(); metrics.addMetric('test_name', MetricUnits.Count, 2); From 9ff1f5cd333bad95ea5a772a2c4f7f6e030cb41c Mon Sep 17 00:00:00 2001 From: Stephan Huber Date: Tue, 23 Aug 2022 12:35:11 +0200 Subject: [PATCH 2/2] docs(metrics): update max dimensions --- docs/core/metrics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/metrics.md b/docs/core/metrics.md index c357a3630c..e2770de640 100644 --- a/docs/core/metrics.md +++ b/docs/core/metrics.md @@ -301,7 +301,7 @@ If you do not use the middleware or decorator, you have to flush your metrics ma !!! warning "Metric validation" If metrics are provided, and any of the following criteria are not met, a **`RangeError`** exception will be thrown: - * Maximum of 9 dimensions + * Maximum of 29 dimensions * Namespace is set only once (or none) * Metric units must be [supported by CloudWatch](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_MetricDatum.html)