Skip to content

Fix: BaggageBuilder.put() accepts empty string keys instead of ignoring them #8657

Description

@NithinU2802

Describe the bug
According to the OpenTelemetry Baggage API Specification, baggage keys must be valid names. Empty string are not valid baggage keys and therefore should not be added to a Baggage.

Steps to reproduce

What did you expect to see?
The builder should ignore entries with empty keys, leaving the Baggage unchanged. This behavior aligns with the OpenTelemetry Baggage API Specification, which requires baggage keys to be valid names.

What did you see instead?
The builder accepts an empty string as a key and adds it to the resulting Baggage.

What version and what artifacts are you using?
Artifacts: opentelemetry-api
Version: main
How did you reference these artifacts? (excerpt from your build.gradle, pom.xml, etc)

Environment
Compiler: Temurin JDK 25
OS: Windows 11
Runtime (if different from JDK above): JDK 25
OS (if different from OS compiled on): NA

Additional context
I did refer the OpenTelemetry Baggage API Specification states that baggage keys must be valid names api.md

I'm happy to get assigned this issue to raise pr!

Tip: React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions