diff --git a/CHANGELOG.md b/CHANGELOG.md index 7335be21804..e1f3b7737eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Upgrade GRPC/protobuf related dependency and regenerate otlp protobufs ([#2201](https://github.com/open-telemetry/opentelemetry-python/pull/2201)) +- Propagation: only warn about oversized baggage headers when headers exist + ([#2212](https://github.com/open-telemetry/opentelemetry-python/pull/2212)) ## [1.6.0-0.25b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.6.0-0.25b0) - 2021-10-13 diff --git a/opentelemetry-api/src/opentelemetry/baggage/propagation/__init__.py b/opentelemetry-api/src/opentelemetry/baggage/propagation/__init__.py index 8ba28357c3a..8430dc23012 100644 --- a/opentelemetry-api/src/opentelemetry/baggage/propagation/__init__.py +++ b/opentelemetry-api/src/opentelemetry/baggage/propagation/__init__.py @@ -53,7 +53,10 @@ def extract( getter.get(carrier, self._BAGGAGE_HEADER_NAME) ) - if not header or len(header) > self._MAX_HEADER_LENGTH: + if not header: + return context + + if len(header) > self._MAX_HEADER_LENGTH: _logger.warning( "Baggage header `%s` exceeded the maximum number of bytes per baggage-string", header,