Skip to content

Commit 222a1ec

Browse files
committed
fix unit test to disable application signals dimensions
1 parent 0bc3211 commit 222a1ec

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

aws-opentelemetry-distro/tests/amazon/opentelemetry/distro/exporter/aws/metrics/test_aws_cloudwatch_emf_exporter.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
import json
5+
import os
56
import time
67
import unittest
78
from unittest.mock import Mock, patch
@@ -358,8 +359,10 @@ def test_create_emf_log(self):
358359
# Check that the result is JSON serializable
359360
json.dumps(result) # Should not raise exception
360361

362+
@patch.dict("os.environ", {"OTEL_METRICS_ADD_APPLICATION_SIGNALS_DIMENSIONS": "false"})
361363
def test_create_emf_log_with_resource(self):
362364
"""Test EMF log creation with resource attributes."""
365+
363366
# Create test records
364367
gauge_record = self.exporter._create_metric_record("gauge_metric", "Count", "Gauge")
365368
gauge_record.value = 50.0
@@ -395,8 +398,10 @@ def test_create_emf_log_with_resource(self):
395398
self.assertEqual(set(cw_metrics["Dimensions"][0]), {"env", "service"})
396399
self.assertEqual(cw_metrics["Metrics"][0]["Name"], "gauge_metric")
397400

401+
@patch.dict("os.environ", {"OTEL_METRICS_ADD_APPLICATION_SIGNALS_DIMENSIONS": "false"})
398402
def test_create_emf_log_without_dimensions(self):
399403
"""Test EMF log creation with metrics but no dimensions."""
404+
400405
# Create test record without attributes (no dimensions)
401406
gauge_record = self.exporter._create_metric_record("gauge_metric", "Count", "Gauge")
402407
gauge_record.value = 75.0

0 commit comments

Comments
 (0)