Skip to content

Add CloudWatch EMF exporter foundation with basic Gauge support #382

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mxiamxia
Copy link
Member

@mxiamxia mxiamxia commented Jun 5, 2025

This PR introduces the core structure for the CloudWatch EMF exporter for sending custom metrics. This foundation 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

Testing:

  • Comprehensive unit tests for core functionality
  • Mock-based testing to avoid AWS dependencies
  • Tests for initialization, conversion, and basic export flow

Future PRs will add:

  • Support for Sum, Histogram, and ExponentialHistogram metrics
  • Advanced batching and CloudWatch Logs constraints
  • Enhanced error handling and validation

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@mxiamxia mxiamxia requested a review from a team as a code owner June 5, 2025 04:12
@mxiamxia mxiamxia force-pushed the pr1-emf-exporter-foundation branch from 2e011f3 to bc2ce38 Compare June 5, 2025 04:15
This PR introduces the core structure for the CloudWatch EMF (Embedded Metric Format)
exporter for OpenTelemetry Python. This foundation includes:

Core Features:
- CloudWatchEMFExporter class with full initialization
- Basic EMF log structure creation
- Gauge metric conversion and export
- Unit mapping from OTel to CloudWatch units
- CloudWatch Logs integration with log group/stream management
- Metric grouping by attributes and timestamps
- Basic error handling and logging

Architecture:
- Follows OTel MetricExporter interface
- Uses boto3 for CloudWatch Logs integration
- Implements proper resource attribute handling
- Supports DELTA temporality for CloudWatch compatibility

Testing:
- Comprehensive unit tests for core functionality
- Mock-based testing to avoid AWS dependencies
- Tests for initialization, conversion, and basic export flow

Future PRs will add:
- Support for Sum, Histogram, and ExponentialHistogram metrics
- Advanced batching and CloudWatch Logs constraints
- Enhanced error handling and validation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@mxiamxia mxiamxia force-pushed the pr1-emf-exporter-foundation branch from bc2ce38 to 8491507 Compare June 5, 2025 04:19
Comment on lines +78 to +84
Args:
namespace: CloudWatch namespace for metrics
log_group_name: CloudWatch log group name
log_stream_name: CloudWatch log stream name (auto-generated if None)
aws_region: AWS region (auto-detected if None)
preferred_temporality: Optional dictionary mapping instrument types to aggregation temporality
**kwargs: Additional arguments passed to boto3 client
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we may have a requirement on resource_to_telemetry_conversion - lets discuss.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants