Skip to content

W3C Baggage Propagator cannot extract multiple baggage headers #6837

@jamesmoessis

Description

@jamesmoessis

Describe the bug

The W3CBaggagePropagator.extract() is generally not able to follow the baggage specification, which states:

Multiple baggage headers are allowed. Values can be combined in a single header according to RFC 7230.

Given that the TextMapGetter.get() method returns a String, as opposed to Enumeration<String>, all instrumentations that I saw return the value for the first header and so some state is lost.

Possible solutions

There are two possible solutions in my mind:

The first is to update the TextMapGetter with a method that is able to return multiple values for a single header, and propagators such as baggage would call this. To keep it stable it could return have a default method that returns the value of get() as some kind of single-valued collection. Then, the baggage propagator could be updated to use this method, and server instrumentations could follow suit to implement this method on their carriers.

The other is to go through all instrumentations and perform the "combined in a single header [RFC 7230]" when extracting the "single" baggage header. This seems likely more hacky and specific to baggage extraction, so it's less preferable in my mind.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingblocked:specblocked on open or unresolved spec

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions