From 684f57d64f50d98d65926ff417bf275208b62caf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Carlos=20Ch=C3=A1vez?= Date: Mon, 10 May 2021 18:11:51 +0200 Subject: [PATCH] chore: improves logs for warning (#1810) Co-authored-by: alrex --- CHANGELOG.md | 2 ++ opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e889bccc13..1c82de004af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Propagators use the root context as default for `extract` and do not modify the context if extracting from carrier does not work. ([#1811](https://github.com/open-telemetry/opentelemetry-python/pull/1811)) +- Improve warning when failing to decode byte attribute + ([#1810](https://github.com/open-telemetry/opentelemetry-python/pull/1810)) ### Removed - Moved `opentelemetry-instrumentation` to contrib repository. diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py index 625b8519ef5..882a7ad4a0d 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py @@ -685,7 +685,10 @@ def set_attributes( try: value = value.decode() except ValueError: - logger.warning("Byte attribute could not be decoded.") + logger.warning( + "Byte attribute could not be decoded for key `%s`.", + key, + ) return self._attributes[key] = value