From f3e1920570785f66d4d98b5e412da586be9187b4 Mon Sep 17 00:00:00 2001 From: jradhakrishnan Date: Mon, 17 Jul 2023 20:29:47 +0530 Subject: [PATCH] Add prefix `d_` for dimension labels [ch16162] --- .../asserts/aws/cloudwatch/metrics/MetricStreamController.java | 2 +- .../aws/cloudwatch/metrics/MetricStreamControllerTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/ai/asserts/aws/cloudwatch/metrics/MetricStreamController.java b/src/main/java/ai/asserts/aws/cloudwatch/metrics/MetricStreamController.java index ae6bb791..9878e3f3 100644 --- a/src/main/java/ai/asserts/aws/cloudwatch/metrics/MetricStreamController.java +++ b/src/main/java/ai/asserts/aws/cloudwatch/metrics/MetricStreamController.java @@ -226,7 +226,7 @@ private void publishMetric(CloudWatchMetric metric) { metricMap.put("namespace", metricNamespace); if (!CollectionUtils.isEmpty(metric.getDimensions())) { - metric.getDimensions().forEach((k, v) -> metricMap.put(metricNameUtil.toSnakeCase(k), v)); + metric.getDimensions().forEach((k, v) -> metricMap.put("d_" + metricNameUtil.toSnakeCase(k), v)); } Optional namespaceOpt = Arrays.stream(CWNamespace.values()).filter(f -> f.getNamespace().equals(metricNamespace)) diff --git a/src/test/java/ai/asserts/aws/cloudwatch/metrics/MetricStreamControllerTest.java b/src/test/java/ai/asserts/aws/cloudwatch/metrics/MetricStreamControllerTest.java index d1ecfb10..aa59df28 100644 --- a/src/test/java/ai/asserts/aws/cloudwatch/metrics/MetricStreamControllerTest.java +++ b/src/test/java/ai/asserts/aws/cloudwatch/metrics/MetricStreamControllerTest.java @@ -314,7 +314,7 @@ private void expectedCallsWhileProcessingData() { SortedMap metricLabels = new TreeMap<>(); metricLabels.put("tenant", "acme"); - metricLabels.put("delivery_stream_name", "PUT-HTP-SliCQ"); + metricLabels.put("d_delivery_stream_name", "PUT-HTP-SliCQ"); metricLabels.put("account_id", "123"); metricLabels.put("namespace", "AWS/Firehose"); metricLabels.put("region", "r1");