From 74cd93eec2cf0800425b3696d025ff6b8466617a Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Wed, 26 Nov 2025 10:25:53 +0100 Subject: [PATCH 1/3] elasticotel/distro: accept warning also May be more mnemonic for people instead of warn. --- src/elasticotel/distro/config.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/elasticotel/distro/config.py b/src/elasticotel/distro/config.py index 21a99c3..c8662fe 100644 --- a/src/elasticotel/distro/config.py +++ b/src/elasticotel/distro/config.py @@ -41,6 +41,7 @@ "debug": logging.DEBUG, "info": logging.INFO, "warn": logging.WARNING, + "warning": logging.WARNING, "error": logging.ERROR, "fatal": logging.CRITICAL, "off": 1000, From 6c34f546629e5ecfc8a08090a5f1c575a0385c1c Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Wed, 26 Nov 2025 10:44:37 +0100 Subject: [PATCH 2/3] docs: Drop stale note This is not true since 1.1.0 --- docs/reference/edot-python/configuration.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/reference/edot-python/configuration.md b/docs/reference/edot-python/configuration.md index cf2fefb..4a30b41 100644 --- a/docs/reference/edot-python/configuration.md +++ b/docs/reference/edot-python/configuration.md @@ -115,10 +115,6 @@ Instrument Python `logging` module to format and forward logs in OTLP format is export OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true ``` -:::{note} -Turning this on will make any call to [logging.basicConfig](https://docs.python.org/3/library/logging.html#logging.basicConfig) from your application a no-op. -::: - #### Differences from OpenTelemetry Python EDOT Python uses different defaults than OpenTelemetry Python for the following configuration options: From 39c02b1bd779c16cc37e453a8408acd96f1d4097 Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Wed, 26 Nov 2025 10:53:03 +0100 Subject: [PATCH 3/3] elasticotel/distro: try harder to print the EDOT configuration at startup Since we rely on the instrumented application logging setup BUT: - by default the python root logger should be at WARNING level - the EDOT Configuration dump is at INFO level - at startup we don't have application logging already setup So we need to add a temporary logging handler just for printing our config --- src/elasticotel/distro/config.py | 8 ++++++++ tests/integration/test_integration.py | 13 +++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/elasticotel/distro/config.py b/src/elasticotel/distro/config.py index c8662fe..ab3759d 100644 --- a/src/elasticotel/distro/config.py +++ b/src/elasticotel/distro/config.py @@ -100,9 +100,17 @@ def log_env_vars(self): for k, v in os.environ.items() if k.startswith("OTEL_") or k.startswith("ELASTIC_OTEL_") ] + # we rely on the application setting up logging and we don't want to interfere with that BUT: + # - by default the python root logger should be at WARNING level + # - the EDOT Configuration dump is at INFO level + # - at startup we don't have application logging already setup + # So we add a temporary handler just for printing our config + handler = logging.StreamHandler() + logger.addHandler(handler) logger.info("EDOT Configuration") for k, v in sorted(env_vars): logger.info("%s: %s", k, v) + logger.handlers.remove(handler) def _handle_logging(self): # do validation, we only validate logging_level because sampling_rate is handled by the sdk already diff --git a/tests/integration/test_integration.py b/tests/integration/test_integration.py index 53ac977..006535e 100644 --- a/tests/integration/test_integration.py +++ b/tests/integration/test_integration.py @@ -213,6 +213,19 @@ def test_script(): self.assertFalse(telemetry["traces"]) self.assertTrue(telemetry["logs"]) + def test_configuration_dump_at_startup_with_info_level(self): + def test_script(): + pass + + env = {"OTEL_LOG_LEVEL": "info", "OTEL_ENV_VAR": "value"} + stdout, stderr, returncode = self.run_script( + test_script, environment_variables=env, wrapper_script="opentelemetry-instrument" + ) + + assert "EDOT Configuration" in stderr + assert "OTEL_LOG_LEVEL: info" in stderr + assert "OTEL_ENV_VAR: value" in stderr + @pytest.mark.integration class HTTPIntegrationTestCase(ElasticIntegrationHTTPTestCase):