Skip to content

Commit f7cd7b6

Browse files
authored
Add CloudWatch EMF exporter foundation with basic Gauge support (#382)
This PR introduces the core structure for the CloudWatch EMF exporter for sending custom metrics. So for some specific customers they can send their own custom OTel metrics to CloudWatch metrics backend without requiring any Collector or Agent installed at this moment. This PR includes: Changes: - Basic EMF log structure creation - Gauge metric conversion and export - Unit mapping from OTel to CloudWatch units - Metric grouping by attributes and timestamps - Supports DELTA temporality for CloudWatch compatibility Future PRs will add: - Support for Sum, Histogram, and ExponentialHistogram metrics - Advanced batching and CloudWatch Logs constraints - Enhanced error handling and validation Testing: - Comprehensive unit tests for core functionality - Mock-based testing to avoid AWS dependencies - Tests for initialization, conversion, and basic export flow ``` cpu_usage_gauge = meter.create_gauge( name="system_cpu_usage_percent", description="Current CPU usage percentage", unit="percent" ) cpu_usage_gauge.set(0.2, {"host": "server-01", "region": "us-east-1"}) ``` <img width="1516" alt="image" src="https://github.com/user-attachments/assets/432e9001-ae03-46b0-917d-323c771864fe" /> ``` { "_aws": { "Timestamp": 1749774096539, "CloudWatchMetrics": [ { "Namespace": "MyApplication1", "Dimensions": [ [ "host", "region" ] ], "Metrics": [ { "Name": "system_cpu_usage_percent", "Unit": "percent" } ] } ] }, "Version": "1", "otel.resource.telemetry.sdk.language": "python", "otel.resource.telemetry.sdk.name": "opentelemetry", "otel.resource.telemetry.sdk.version": "1.27.0", "otel.resource.service.name": "my-service", "otel.resource.service.version": "0.1.0", "otel.resource.deployment.environment": "production", "system_cpu_usage_percent": 0.2, "host": "server-01", "region": "us-east-1" } ``` By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
1 parent 779e89b commit f7cd7b6

File tree

2 files changed

+1070
-0
lines changed

2 files changed

+1070
-0
lines changed

0 commit comments

Comments
 (0)