Skip to content

Commit

Permalink
fix(baggage): oversized header warn only with a header (#2212)
Browse files Browse the repository at this point in the history
This commit makes sure that warnings about the baggage header length are
only emitted when the header is actually present, since it does not make
sense to warn about a missing header's length.
  • Loading branch information
marier-nico authored Oct 16, 2021
1 parent 39fe4db commit 73230b6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 73230b6

Please sign in to comment.