Skip to content

Conversation

jj22ee
Copy link
Contributor

@jj22ee jj22ee commented Aug 13, 2025

Issue #, if available:

Description of changes:
This PR Cherry-picks:
9b4905f
b6fb638
2388f5f
339e83c
fc2ef84
2a94c9a
a51b226

Testing:
git diff other/main --name-only
Result:

.github/actions/artifacts_build/action.yml
.github/actions/image_scan/action.yml
.github/workflows/application-signals-e2e-test.yml
.github/workflows/daily_scan.yml
.github/workflows/post_release_version_bump.yml
.github/workflows/pr_build.yml
.github/workflows/pre_release_prepare.yml
.github/workflows/release_build.yml

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

This PR prepares the main branch for the next development cycle by
updating the version to 0.10.1.dev0 and updating the image version to be
scanned to the latest released.

This PR should only be merge when release for version v0.10.1 is
success.

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: github-actions <[email protected]>
Co-authored-by: Steve Liu <[email protected]>
Co-authored-by: Min Xia <[email protected]>
*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]>
*Issue #, if available:*

*Description of changes:*

*Testing:*
Lambda code:
```
import json
import logging

from logging import Logger, getLogger

_logger: Logger = getLogger("__name__")

def lambda_handler(event, context):
    _logger.error("helloooooo1")
    _logger.error("helloooooo2")
    _logger.error("helloooooo3")
    _logger.error("helloooooo4")
    _logger.error("helloooooo5")
    return {
        'statusCode': 200,
        'body': json.dumps('Hello from Lambda!')
    }
```

Env vars:
```
AWS_LAMBDA_EXEC_WRAPPER=/opt/otel-instrument
OTEL_LOGS_EXPORTER=otlp
OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true
```
See that one log is in one CWLog line.
<img width="2344" height="748" alt="image"
src="https://github.com/user-attachments/assets/3f09900e-fad6-4f90-b9a4-a8006a5b259d"
/>


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

*Description of changes:*


By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
*Description of changes:*
When setting `OTEL_PYTHON_CONFIGURATOR=aws_configurator`, users see a
verbose warning message:

`Configuration of configurator not loaded because aws_configurator is
set by OTEL_PYTHON_CONFIGURATOR`

These warnings appear when multiple OpenTelemetry configurators are
installed (e.g., default upstream configurators alongside the AWS
configurator). While the behavior is correct, the warnings create noise
in application logs.

Disabling this log message from showing up by default.

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
*Description of changes:*
`OTEL_PYTHON_LOG_LEVEL` uses lowercase for log levels. Changing it to
fix the uppercase only from this PR:

#449

**Testing this on Lambda (with default Lambda config setup)**:
<img width="1302" height="200" alt="image"
src="https://github.com/user-attachments/assets/4b4070bf-90e6-48ae-a787-1dfee1072512"
/>
```
START RequestId: 0157a3c0-c584-49bc-b5ba-fd2008335b83 Version: $LATEST
END RequestId: 0157a3c0-c584-49bc-b5ba-fd2008335b83
REPORT RequestId: 0157a3c0-c584-49bc-b5ba-fd2008335b83	Duration: 230.96 ms	Billed Duration: 231 ms	Memory Size: 512 MB	Max Memory Used: 113 MB	Init Duration: 1416.80 ms	
XRAY TraceId: 1-689b663c-01c68093613ed19523fb9c6f	SegmentId: 76d15c82545c2530	Sampled: true	
```

**Testing this on Lambda (with modified Lambda config setup)**:
<img width="1378" height="264" alt="image"
src="https://github.com/user-attachments/assets/66a75fb5-77af-49eb-bf23-ad65a4dbdb65"
/>
```
Configuration of configurator not loaded, aws_configurator already loaded
START RequestId: 16d4902c-527b-4edd-86ef-abd423da365d Version: $LATEST
END RequestId: 16d4902c-527b-4edd-86ef-abd423da365d
REPORT RequestId: 16d4902c-527b-4edd-86ef-abd423da365d	Duration: 166.12 ms	Billed Duration: 167 ms	Memory Size: 512 MB	Max Memory Used: 113 MB	Init Duration: 1467.68 ms	
XRAY TraceId: 1-689b6692-1ea1293937b97276187b0a71	SegmentId: d2ed420726a62b67	Sampled: true	
```

See:
https://opentelemetry.io/docs/zero-code/python/configuration/#logging
For valid logging values.

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.
*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]>
@jj22ee jj22ee requested a review from a team as a code owner August 13, 2025 21:40
@jj22ee jj22ee merged commit 77c9175 into release/v0.10.x Aug 13, 2025
13 checks passed
@jj22ee jj22ee deleted the 0.10.2_release branch August 13, 2025 22:07
jj22ee added a commit that referenced this pull request Aug 13, 2025
jj22ee added a commit that referenced this pull request Aug 13, 2025
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.

4 participants