Skip to content

Skip empty baggage key in OtTracePropagator extract#8631

Draft
thswlsqls wants to merge 1 commit into
open-telemetry:mainfrom
thswlsqls:fix/ot-trace-propagator-empty-baggage-key
Draft

Skip empty baggage key in OtTracePropagator extract#8631
thswlsqls wants to merge 1 commit into
open-telemetry:mainfrom
thswlsqls:fix/ot-trace-propagator-empty-baggage-key

Conversation

@thswlsqls

Copy link
Copy Markdown
Contributor

Fixes #8629

Description

  • OtTracePropagator.extract() only checked startsWith(PREFIX_BAGGAGE_HEADER), so a header named exactly ot-baggage- produced a baggage entry keyed "". inject() re-emits it, and it consumes one of the 64 baggage entries.
  • Skip a header whose length equals the prefix length, matching JaegerPropagator.getBaggageFromHeader() and its extract_baggageOnly_withPrefix_emptyKey test in the same package.
  • An empty key is not a valid baggage key here: W3CBaggagePropagator.isValidBaggageKey() rejects it, and the ImmutableKeyValuePairs Javadoc makes removing empty keys the caller's responsibility.
  • Handling of normal ot-baggage-<key> headers, byte accounting, and limits are unchanged.

Testing done

  • Added OtTracePropagatorTest#extract_Baggage_EmptyKey, asserting Baggage.empty() for a valid span context plus an ot-baggage- header.
  • Not vacuous: reverting the production change fails it.
  • ./gradlew :extensions:trace-propagators:check --rerun-tasks — 132 tests passed.
  • No apidiff (method body only) and no CHANGELOG (only malformed entries stop being extracted).
  • *IT and GraalVM native-image tests were not run locally.

@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.60%. Comparing base (b86f040) to head (8045f71).

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #8631   +/-   ##
=========================================
  Coverage     91.60%   91.60%           
- Complexity    10343    10344    +1     
=========================================
  Files          1013     1013           
  Lines         27352    27353    +1     
  Branches       3215     3216    +1     
=========================================
+ Hits          25057    25058    +1     
  Misses         1567     1567           
  Partials        728      728           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OtTracePropagator extracts an empty baggage key from an ot-baggage- header

1 participant