Skip to content

Commit

Permalink
feat(metrics): increase maximum dimensions to 29 (#1072)
Browse files Browse the repository at this point in the history
* improv(metrics): Add support to 30 dimensions

* docs(metrics): update max dimensions
  • Loading branch information
sthuber90 authored Aug 23, 2022
1 parent c3b9a37 commit 7b9a027
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/core/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion packages/metrics/src/Metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

/**
Expand Down
5 changes: 3 additions & 2 deletions packages/metrics/tests/unit/Metrics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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' });
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 7b9a027

Please sign in to comment.