open-telemetry / open-telemetry/opentelemetry-java

Move validation methods to public api

Open
#2,944 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

blocked:spec Feature Request
Dominant language
Java
Stars
2.5k
Forks
1k
Avg merge
3d 17h
Merged PRs (30d)
58

Description

As discussed in https://github.com/open-telemetry/opentelemetry-java/issues/2935, we need to add our own validation.

In addition, we need to pre-check the values coming in from headers, to avoid trying to call BaggageBuilder.put with a null or empty string.

Currently the code to validate keys and values is in private static methods in ImmutableBuilder, and those in turn call methods that are in io.opentelemetry.api.internal.StringUtils, which is an internal package.

We don't want to just copy this code.

(If it's safe to call code in internal packages, let us know and that part we'll drop from this request.)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading issue 2935, then inspect the private validation methods in ImmutableBuilder and the referenced methods in io.opentelemetry.api.internal.StringUtils. Determine how validation should be exposed through the public API and how header values are pre-checked before BaggageBuilder.put; done means both concerns no longer depend on copied validation logic or null/empty inputs.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.