|
2 | 2 | # SPDX-License-Identifier: Apache-2.0 |
3 | 3 |
|
4 | 4 | import json |
| 5 | +import os |
5 | 6 | import time |
6 | 7 | import unittest |
7 | 8 | from unittest.mock import Mock, patch |
@@ -358,8 +359,10 @@ def test_create_emf_log(self): |
358 | 359 | # Check that the result is JSON serializable |
359 | 360 | json.dumps(result) # Should not raise exception |
360 | 361 |
|
| 362 | + @patch.dict("os.environ", {"OTEL_METRICS_ADD_APPLICATION_SIGNALS_DIMENSIONS": "false"}) |
361 | 363 | def test_create_emf_log_with_resource(self): |
362 | 364 | """Test EMF log creation with resource attributes.""" |
| 365 | + |
363 | 366 | # Create test records |
364 | 367 | gauge_record = self.exporter._create_metric_record("gauge_metric", "Count", "Gauge") |
365 | 368 | gauge_record.value = 50.0 |
@@ -395,8 +398,10 @@ def test_create_emf_log_with_resource(self): |
395 | 398 | self.assertEqual(set(cw_metrics["Dimensions"][0]), {"env", "service"}) |
396 | 399 | self.assertEqual(cw_metrics["Metrics"][0]["Name"], "gauge_metric") |
397 | 400 |
|
| 401 | + @patch.dict("os.environ", {"OTEL_METRICS_ADD_APPLICATION_SIGNALS_DIMENSIONS": "false"}) |
398 | 402 | def test_create_emf_log_without_dimensions(self): |
399 | 403 | """Test EMF log creation with metrics but no dimensions.""" |
| 404 | + |
400 | 405 | # Create test record without attributes (no dimensions) |
401 | 406 | gauge_record = self.exporter._create_metric_record("gauge_metric", "Count", "Gauge") |
402 | 407 | gauge_record.value = 75.0 |
|
0 commit comments