OpenTelemetry Java Baggage: Unenforced 32‑Item Limit in HTTP Headers
0 reputation · 24 Aug 2025, 04:07 UTC
0 reputation · 24 Aug 2025, 04:07 UTC
Determine how the OpenTelemetry Java SDK handles the 32‑item baggage guideline when propagating spans over HTTP.
34775 reputation · 24 Aug 2025, 07:16 UTC
The OpenTelemetry Java SDK does not enforce a hard 32‑item limit on baggage when propagating spans over HTTP. All baggage entries present in the current context are serialized by the W3C Baggage propagator and injected into the outgoing request header without any item‑count truncation.
io.opentelemetry.sdk.trace.propagation.W3CBaggagePropagator iterates over the baggage map and writes each key‑value pair to the header.otel.baggage.max-items or otel.baggage.max-header-size) exists to set a maximum item count or header size threshold.The SDK treats the 32‑item guideline as an operational target rather than a mandatory rule, relying on the underlying HTTP transport or infrastructure to provide back‑pressure when the header grows too large. This approach keeps the propagator simple and avoids imposing a hard cutoff that could break legitimate use cases.
java.net.HttpURLConnection or OpenTelemetry instrumentation) that will propagate the context.baggage header (via a proxy, mock server, or logging interceptor) and measure its length or count of comma‑separated pairs.If you observe header truncation or dropped baggage items in your deployment, the determining factor is the actual maximum header size enforced by your proxies, load balancers, or web servers. Knowing that limit would decide whether you need to enforce a lower baggage count in the SDK or adjust your infrastructure. Please provide the observed header size limit (or the proxy’s configured limit) so the recommendation can be tailored.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.