diff --git a/docs/core/metrics.md b/docs/core/metrics.md index c357a3630..e2770de64 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) diff --git a/packages/metrics/src/Metrics.ts b/packages/metrics/src/Metrics.ts index 39a0d09ec..429e8a7d5 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 bb59bde57..345306714 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);