--- id: aws-embedded-metrics version: "3.5.0" license: unclear license_treatment: permissive maintenance: active --- # aws-embedded-metrics — AWS Embedded Metrics Package License: permissive · Maintenance: active · Downloads: 1.8M/mo ## What it is and what it does aws-embedded-metrics is a Python library for publishing custom CloudWatch metrics alongside structured log events. It wraps metric emission in the Embedded Metric Format (EMF), which CloudWatch automatically extracts so you can visualize, alarm on, and aggregate metrics in real time without writing custom batching code or making blocking network requests. The library automatically injects environment metadata (Lambda version, EC2 instance IDs, etc.) into logs and supports both standard and high-resolution metrics. You decorate your function with @metric_scope, then call methods like put_metric(), put_dimensions(), and set_property() on the metrics object to record values and context. The library handles flushing metrics to CloudWatch and formatting them according to EMF. It works across Lambda, EC2, ECS, EKS, and on-premises environments (the latter via CloudWatch Agent), and integrates with CloudWatch Logs Insights for querying high-cardinality context that wouldn't be suitable as metric dimensions. Use it for: - Emit custom metrics from Lambda functions without custom batching or blocking network calls - Link metrics to high-cardinality context (request IDs, device IDs) queryable via CloudWatch Logs Insights - Monitor aggregated values across EC2, ECS, EKS, or on-premises compute while preserving detailed event logs - Track both standard (1-minute) and high-resolution (sub-minute) metrics from application code - Automatically capture environment metadata (Lambda version, instance IDs) alongside custom metrics ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Generates CloudWatch metrics embedded within structured log events, allowing you to visualize and alarm on custom metrics while preserving detailed event context for querying. Yes. The package is production-stable, actively maintained, has low install friction, permissive licensing, and no known vulnerabilities. It solves a real AWS monitoring problem—emitting custom metrics without blocking calls or external dependencies—and is widely used (top 5000 PyPI packages). Install it if you need to publish CloudWatch metrics from Lambda or other AWS compute environments. ## Install pip install aws-embedded-metrics uv add aws-embedded-metrics poetry add aws-embedded-metrics ## Installing aws-embedded-metrics Before you install: Low install friction with a single runtime dependency (aiohttp). Actively maintained with recent commits and production-stable status. Supports current Python versions (3.6+). License in practice: Licensed under Apache Software License (permissive), allowing commercial and private use with minimal restrictions. Quickstart: pip install aws-embedded-metrics from aws_embedded_metrics import metric_scope from aws_embedded_metrics.storage_resolution import StorageResolution @metric_scope def my_handler(metrics): metrics.put_dimensions({"Foo": "Bar"}) metrics.put_metric("ProcessingLatency", 100, "Milliseconds", StorageResolution.STANDARD) metrics.set_property("RequestId", "422b1569-16f6-4a03") return {"message": "Hello!"} Verify before relying: - Whether aiohttp is required for all use cases or only for async operations - Performance characteristics with high-throughput generators and the v4.0 flush behavior change ## Package facts - License: not declared (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 1.8M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags cloudwatch metrics logging, embedded metric format python, aws lambda custom metrics, structured logging with metrics, cloudwatch logs insights integration, metric emission without batching, aws monitoring library, aws-native, observability [View on SkillFed](https://skillfed.io/packages/aws-embedded-metrics) · [View on PyPI](https://pypi.org/project/aws-embedded-metrics/)