Skip to content

Conversation

wangzlei
Copy link
Contributor

@wangzlei wangzlei commented Jul 30, 2025

Issue #, if available:

The current Lambda instrumentation is missing a call to the loggerProvider.force_flush method, which can result in delayed or missing OTel logs in the Lambda environment due to Lambda freeze

Description of changes:
Adding LoggerProvider force flush in Lambda instrumentation.
Logging a debug log if the loggerProvider does not support force flush because the default global LoggerProvider is ProxyLoggerProvider in OpenTelemetry Python, will be replaced to SDKLoggerProvider only if user set environment variable OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED = true, which is not set in ADOT Lambda layer.

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 30, 2025 18:43
@wangzlei wangzlei merged commit a51b226 into aws-observability:main Aug 13, 2025
13 checks passed
jj22ee added a commit that referenced this pull request Aug 13, 2025
*Issue #, if available:*

The current Lambda instrumentation is missing a call to the
loggerProvider.force_flush method, which can result in delayed or
missing OTel logs in the Lambda environment due to Lambda freeze

*Description of changes:*
Adding LoggerProvider force flush in Lambda instrumentation.
Logging a debug log if the loggerProvider does not support force flush
because the default global LoggerProvider is ProxyLoggerProvider in
OpenTelemetry Python, will be replaced to SDKLoggerProvider only if user
set environment variable
`OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED = true`, which is not
set in ADOT Lambda layer.

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