open-telemetry / open-telemetry/opentelemetry-java
Support additional validation for keys and values in baggage builder
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 2.5k
- Forks
- 1k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 58
Description
We need to restrict the keys and values in our baggage, to avoid having it become an untyped free-for-all dumping ground, and to keep it from exceeding the size limits).
We were hoping to do that by subclassing ImmutableBaggage.Builder and overriding the put method.
Unfortunately, we can't see private final List data;, so when we try to override the put method, it won't compile.
An easy fix would be to provide a protected accessor, similar to the one in ArrayBackedBaggage, but it might be better to provide an overload of the put method that has parameters for a BaggageKeyValidator and a BaggageValueValidator.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating ImmutableBaggage.Builder and its put method, then compare the related accessor in ArrayBackedBaggage. Review the issue's two proposed extension approaches and determine which API shape supports key and value validation without exposing private state. Done means the selected approach allows baggage restrictions while preserving the builder's existing behavior and size limits.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100