aws-embedded-metrics
AWS Embedded Metrics Package
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 on this page — 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
aws-embedded-metrics on PyPI
pip
pip install aws-embedded-metricsuv
uv add aws-embedded-metricspoetry
poetry add aws-embedded-metricsInstalling 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 the current Python release (>=3.6) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — aiohttp |
| Maintenance | actively maintained — 140 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,791,041/month — #3,555 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: aws_embedded_metrics-3.5.0-py3-none-any.whl
Keywords: aws, logs, metrics, emf
Tags
More Monitoring packages
Wraps any iterable to display a real-time…
copyleft · top 100 on PyPI
opentelemetry-semantic-conventionsProvides generated Python code for…
permissive · top 100 on PyPI
opentelemetry-sdkProvides the reference implementation of the…
permissive · top 100 on PyPI
opentelemetry-apiProvides the abstract API and interfaces for…
permissive · top 100 on PyPI
opentelemetry-exporter-otlp-proto-httpExports OpenTelemetry observability data to an…
permissive · top 1,000 on PyPI
opentelemetry-instrumentationProvides automatic instrumentation commands and…
permissive · top 1,000 on PyPI
awsmeSends AWS CloudWatch metrics asynchronously and…
permissive · top 15,000 on PyPI
aws-cdk.aws-cloudwatchDefines CloudWatch metrics, alarms, and…
permissive · top 15,000 on PyPI
awslogsawslogs is a command-line tool for querying and…
permissive · top 15,000 on PyPI
awslabs.cloudwatch-mcp-serverExposes CloudWatch metrics, logs, alarms, and…
permissive · top 15,000 on PyPI
lambda-warmer-pyA decorator that minimizes AWS Lambda cold…
permissive · top 15,000 on PyPI
cloudwatchA Python logging handler that sends log events…
permissive · top 15,000 on PyPI
aws-cdk.aws-logsProvides AWS CDK constructs for creating and…
permissive · top 15,000 on PyPI
watchtowerWatchtower is a Python logging handler that…
permissive · top 1,000 on PyPI
r7insight-pythonSends Python application logs and performance…
permissive · top 15,000 on PyPI
azure-monitor-querymetricsQuery and retrieve numerical metrics data from…
permissive · top 15,000 on PyPI