From 21f4a20b656cc5aecd9d51b2f2d765316d16be30 Mon Sep 17 00:00:00 2001 From: Anton Pirker Date: Tue, 30 Jul 2024 18:27:29 +0200 Subject: [PATCH 1/2] opentelemetry-api: Allow `importlib_metadata<=8.2` (#4089) --- opentelemetry-api/pyproject.toml | 2 +- opentelemetry-api/test-requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/opentelemetry-api/pyproject.toml b/opentelemetry-api/pyproject.toml index 7278412f258..999e5ffe870 100644 --- a/opentelemetry-api/pyproject.toml +++ b/opentelemetry-api/pyproject.toml @@ -29,7 +29,7 @@ dependencies = [ "Deprecated >= 1.2.6", # FIXME This should be able to be removed after 3.12 is released if there is a reliable API # in importlib.metadata. - "importlib-metadata >= 6.0, <= 8.0.0", + "importlib-metadata >= 6.0, <= 8.2.0", ] dynamic = [ "version", diff --git a/opentelemetry-api/test-requirements.txt b/opentelemetry-api/test-requirements.txt index 9dbb8596c71..b8ac6b632b8 100644 --- a/opentelemetry-api/test-requirements.txt +++ b/opentelemetry-api/test-requirements.txt @@ -1,6 +1,6 @@ asgiref==3.7.2 Deprecated==1.2.14 -importlib-metadata==6.11.0 +importlib-metadata==8.2.0 iniconfig==2.0.0 packaging==24.0 pluggy==1.5.0 From b9cadc09f8cfde965809ac2d47c6369678bea0c9 Mon Sep 17 00:00:00 2001 From: Tammy Baylis <96076570+tammy-baylis-swi@users.noreply.github.com> Date: Tue, 30 Jul 2024 09:43:48 -0700 Subject: [PATCH 2/2] Update logs example re root logger (#4090) --- CHANGELOG.md | 1 + docs/examples/logs/example.py | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c0ee94f3152..c69fee17385 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added py.typed file to top-level module ([#4084](https://github.com/open-telemetry/opentelemetry-python/pull/4084)) - Drop Final annotation from Enum in semantic conventions ([#4085](https://github.com/open-telemetry/opentelemetry-python/pull/4085)) +- Update log export example to not use root logger ([#4090](https://github.com/open-telemetry/opentelemetry-python/pull/4090)) ## Version 1.26.0/0.47b0 (2024-07-25) diff --git a/docs/examples/logs/example.py b/docs/examples/logs/example.py index 2505aacea7a..ba471ea7e69 100644 --- a/docs/examples/logs/example.py +++ b/docs/examples/logs/example.py @@ -36,10 +36,9 @@ # Attach OTLP handler to root logger logging.getLogger().addHandler(handler) -# Log directly -logging.info("Jackdaws love my big sphinx of quartz.") - # Create different namespaced loggers +# It is recommended to not use the root logger with OTLP handler +# so telemetry is collected only for the application logger1 = logging.getLogger("myapp.area1") logger2 = logging.getLogger("myapp.area2")