Skip to content

Commit 7b9a027

Browse files
authored
feat(metrics): increase maximum dimensions to 29 (#1072)
* improv(metrics): Add support to 30 dimensions * docs(metrics): update max dimensions
1 parent c3b9a37 commit 7b9a027

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

Diff for: docs/core/metrics.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ If you do not use the middleware or decorator, you have to flush your metrics ma
301301
!!! warning "Metric validation"
302302
If metrics are provided, and any of the following criteria are not met, a **`RangeError`** exception will be thrown:
303303

304-
* Maximum of 9 dimensions
304+
* Maximum of 29 dimensions
305305
* Namespace is set only once (or none)
306306
* Metric units must be [supported by CloudWatch](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_MetricDatum.html)
307307

Diff for: packages/metrics/src/Metrics.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
} from './types';
1515

1616
const MAX_METRICS_SIZE = 100;
17-
const MAX_DIMENSION_COUNT = 9;
17+
const MAX_DIMENSION_COUNT = 29;
1818
const DEFAULT_NAMESPACE = 'default_namespace';
1919

2020
/**

Diff for: packages/metrics/tests/unit/Metrics.test.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { Metrics, MetricUnits } from '../../src/';
1313
import { populateEnvironmentVariables } from '../helpers';
1414

1515
const MAX_METRICS_SIZE = 100;
16-
const MAX_DIMENSION_COUNT = 9;
16+
const MAX_DIMENSION_COUNT = 29;
1717
const DEFAULT_NAMESPACE = 'default_namespace';
1818

1919
const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
@@ -371,7 +371,7 @@ describe('Class: Metrics', () => {
371371
}
372372
});
373373

374-
test('Error should be thrown on empty metrics when throwOnEmptyMetrics() is callse', async () => {
374+
test('Error should be thrown on empty metrics when throwOnEmptyMetrics() is called', async () => {
375375
expect.assertions(1);
376376

377377
const metrics = new Metrics({ namespace: 'test' });
@@ -459,6 +459,7 @@ describe('Class: Metrics', () => {
459459
});
460460

461461
test('Should throw an error if the same metric name is added again with a different unit', ()=> {
462+
expect.assertions(1);
462463
const metrics = new Metrics();
463464

464465
metrics.addMetric('test_name', MetricUnits.Count, 2);

0 commit comments

Comments
 (0)