Skip to content

Commit 2a94c9a

Browse files
authored
Change _load logging to lowercase (#450)
*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.
1 parent fc2ef84 commit 2a94c9a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

aws-opentelemetry-distro/src/amazon/opentelemetry/distro/aws_opentelemetry_distro.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,16 @@
2323
from opentelemetry.distro import OpenTelemetryDistro
2424
from opentelemetry.environment_variables import OTEL_PROPAGATORS, OTEL_PYTHON_ID_GENERATOR
2525
from opentelemetry.instrumentation.auto_instrumentation import _load
26+
from opentelemetry.instrumentation.logging import LEVELS
2627
from opentelemetry.instrumentation.logging.environment_variables import OTEL_PYTHON_LOG_LEVEL
2728
from opentelemetry.sdk.environment_variables import (
2829
OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION,
2930
OTEL_EXPORTER_OTLP_PROTOCOL,
3031
)
3132

3233
_logger: Logger = getLogger(__name__)
33-
# Suppress configurator warnings from OpenTelemetry auto-instrumentation
34-
_load._logger.setLevel(os.environ.get(OTEL_PYTHON_LOG_LEVEL, ERROR))
34+
# Suppress configurator warnings from auto-instrumentation
35+
_load._logger.setLevel(LEVELS.get(os.environ.get(OTEL_PYTHON_LOG_LEVEL, "error").lower(), ERROR))
3536

3637

3738
class AwsOpenTelemetryDistro(OpenTelemetryDistro):

0 commit comments

Comments
 (0)