Skip to content

Commit 9f188b9

Browse files
committed
disable warning messages from OTel auto instrumentation
1 parent 339e83c commit 9f188b9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
# SPDX-License-Identifier: Apache-2.0
33
import importlib
4+
import logging
45
import os
56
import sys
67
from logging import Logger, getLogger
@@ -22,12 +23,15 @@
2223
from opentelemetry import propagate
2324
from opentelemetry.distro import OpenTelemetryDistro
2425
from opentelemetry.environment_variables import OTEL_PROPAGATORS, OTEL_PYTHON_ID_GENERATOR
26+
from opentelemetry.instrumentation.auto_instrumentation import _load
2527
from opentelemetry.sdk.environment_variables import (
2628
OTEL_EXPORTER_OTLP_METRICS_DEFAULT_HISTOGRAM_AGGREGATION,
2729
OTEL_EXPORTER_OTLP_PROTOCOL,
2830
)
2931

3032
_logger: Logger = getLogger(__name__)
33+
# Suppress configurator warnings from OpenTelemetry auto-instrumentation
34+
_load._logger.setLevel(logging.ERROR)
3135

3236

3337
class AwsOpenTelemetryDistro(OpenTelemetryDistro):
@@ -89,6 +93,8 @@ def _configure(self, **kwargs):
8993
)
9094

9195
if is_agent_observability_enabled():
96+
# Disable unnecessary
97+
_load._logger.setLevel(logging.ERROR)
9298
# "otlp" is already native OTel default, but we set them here to be explicit
9399
# about intended configuration for agent observability
94100
os.environ.setdefault(OTEL_TRACES_EXPORTER, "otlp")

0 commit comments

Comments
 (0)