Skip to content

JaegerPropagator overwrites existing baggage with empty baggage #8630

Description

@thswlsqls

Describe the bug

JaegerPropagator.extract() erases baggage that an earlier propagator already extracted when the jaeger-baggage header contains no parsable key=value entry.

Steps to reproduce

Configure otel.propagators=tracecontext,baggage,jaeger and send a request with both a valid W3C baggage header and a jaeger-baggage header that has no parsable entry (user=, an empty value, or nometa+novalue). The W3C baggage is gone from the extracted context.

What did you expect to see?

The existing baggage preserved. Three siblings already guard this: the uberctx- branch of the same method only creates a builder when it puts an entry, OtTracePropagator.extract() guards with if (!baggage.isEmpty()), and W3CBaggagePropagator.extractMulti() returns the context unchanged when it extracted nothing.

What did you see instead?

Baggage.empty(). JaegerPropagator.getBaggageFromHeader() (line 281) creates a builder whenever the header value is non-null, so line 294 returns an empty but non-null Baggage. extract() (line 166) stores it, and Baggage.storeInContext() replaces the previous value unconditionally.

What version and what artifacts are you using?

Artifacts: opentelemetry-extension-trace-propagators
Version: main @ b86f040

Environment

Compiler: Temurin 21
OS: N/A

Additional context

Incomplete fix from #8380, which added the !baggage.isEmpty() guard to OtTracePropagator and the lazy builder to the uberctx- branch but left this branch. Nothing is logged when the baggage disappears.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions