Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BaggageManager#getBaggage() is inconsistent when baggage doesn't exist #237

Closed
adrian-skybaker opened this issue Apr 20, 2023 · 1 comment
Labels
bug A general bug
Milestone

Comments

@adrian-skybaker
Copy link

The contract for io.micrometer.tracing.BaggageManager#getBaggage(java.lang.String) is:

@return baggage or {@code null} if not present

However, the otel implementation will create a blank (empty string) entry if not present:

    public io.micrometer.tracing.Baggage getBaggage(String name) {
        Entry entry = getBaggage(name, currentBaggage());
        return createNewEntryIfMissing(name, entry);
    }

Glancing at the code the brave implementation is sort of similar in that it also creates a baggage entry if missing, but the value looks null instead of blank string?

So it seems there are three implementations:

  • (doc) return null
  • (otel) return baggage with empty string value
  • (brave) return baggage with null value

which is correct? The otel seems the most wrong to me, empty string looks like an actual value.

@marcingrzejszczak marcingrzejszczak added the bug A general bug label Apr 24, 2023
@marcingrzejszczak marcingrzejszczak added this to the 1.0.5 milestone Apr 24, 2023
@marcingrzejszczak
Copy link
Contributor

fixed via daaacab

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants