Skip to content

Conversation

wangzlei
Copy link
Contributor

Issue #, if available:
Currently, OpenTelemetry (OTel) metrics users in AWS Lambda must export metrics via synchronous calls. This often results in increased function duration or lost metric data, due to how Lambda handles execution lifecycle — particularly during the freeze phase.

Description of changes:
This PR introduces a new ConsoleEmfExporter, which exports OTel metrics to standard output using the CloudWatch Embedded Metric Format (EMF).
In the Lambda environment, logs written to standard output are automatically forwarded to CloudWatch by Lambda's built-in logging agent. This makes ConsoleEmfExporter a simple and efficient way to export OTel metrics in Lambda, avoiding the overhead and reliability issues associated with synchronous metric export.

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

@wangzlei wangzlei requested a review from a team as a code owner July 24, 2025 21:29
@wangzlei wangzlei merged commit b6fb638 into aws-observability:main Jul 30, 2025
13 checks passed
jj22ee added a commit that referenced this pull request Aug 13, 2025
*Issue #, if available:*
Currently, OpenTelemetry (OTel) metrics users in AWS Lambda must export
metrics via synchronous calls. This often results in increased function
duration or lost metric data, due to how Lambda handles execution
lifecycle — particularly during the [freeze
phase](https://serverlessfolks.com/lambda-code-execution-freezethaw#heading-freeze).


*Description of changes:*
This PR introduces a new ConsoleEmfExporter, which exports OTel metrics
to standard output using the CloudWatch Embedded Metric Format (EMF).
In the Lambda environment, logs written to standard output are
automatically forwarded to CloudWatch by Lambda's built-in logging
agent. This makes ConsoleEmfExporter a simple and efficient way to
export OTel metrics in Lambda, avoiding the overhead and reliability
issues associated with synchronous metric export.

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

---------

Co-authored-by: Jonathan Lee <[email protected]>
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.

3 participants