Skip to content

To remove cross module internal utility usage from trace propagators - #8955

Open
NithinU2802 wants to merge 12 commits into
open-telemetry:mainfrom
NithinU2802:fix/trace-propagator-internal-utilities
Open

NithinU2802 wants to merge 12 commits into
open-telemetry:mainfrom
NithinU2802:fix/trace-propagator-internal-utilities

Conversation

@NithinU2802

@NithinU2802 NithinU2802 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

This PR is to resolves a part #6970 by updating the trace-propagators module’s dependency on API internal utility classes.

Changes

  • Add trace-propagators local StringUtils and TemporaryBuffers utilities.
  • Update B3, Jaeger, and OT trace propagators to use the local utilities which are created.
  • Add explicit null accordingly to the files.
  • Did pick methods which are used from the API internal utility classes.

@NithinU2802
NithinU2802 requested a review from a team as a code owner October 18, 2026 08:13
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Waiting on the author · refreshed 2026-10-23 20:25 UTC

Investigate required status check failures.

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Should this be with reviewers? Comment /dashboard route:reviewers to route it to them.
  • Anything wrong — including the routing? Report it with what you expected; it helps us improve the dashboard.

@codecov

codecov Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.42%. Comparing base (877820b) to head (655ddd2).

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #8955   +/-   ##
=========================================
  Coverage     90.41%   90.42%           
- Complexity    10981    10992   +11     
=========================================
  Files          1019     1020    +1     
  Lines         30016    30026   +10     
  Branches       3917     3920    +3     
=========================================
+ Hits          27140    27151   +11     
- Misses         1923     1924    +1     
+ Partials        953      951    -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

* @param minLength the minimum length of the returned string
* @return the padded string, or {@code value} if it already meets the minimum length
*/
static String padLeft(String value, int minLength) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is only used in the opentelemetry-extension-trace-propagators module and tests, so let's go ahead and remove it from io.opentelemetry.api.internal.StringUtils.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is also used here in SdkLoggerTest.java, Line 79

* @param string the string to check
* @return {@code true} if {@code string} is {@code null} or empty
*/
static boolean isNullOrEmpty(@Nullable String string) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this method is kind of silly. Better to just enumerate the string == null || string.isEmpty() condition in the places that use it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah ok

* <p>This class is internal and is hence not for public use. Its APIs are unstable and can change
* at any time.
*/
final class TemporaryBuffers {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should consider promoting this to a .impl. API since a second ThreadLocal increases the the allocation per thread when reuse is safe

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah ok, I will move this TemporaryBuffers to api.impl and update the imports accordingly to follow this approach which avoid additional ThreadLocal creation.

@otelbot otelbot Bot added the api-change Changes to public API surface area label Oct 20, 2026
@otelbot

otelbot Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

⚠️ API changes detected — additional maintainer review required

@jack-berg @jkwatson

This PR modifies the public API surface area of the following module(s):

  • opentelemetry-api

Please review the changes in docs/apidiffs/current_vs_latest/ carefully before approving.

@NithinU2802
NithinU2802 requested a review from jack-berg October 20, 2026 07:02
+++ NEW CLASS: PUBLIC(+) FINAL(+) io.opentelemetry.api.impl.TemporaryBuffers (not serializable)
+++ CLASS FILE FORMAT VERSION: 52.0 <- n.a.
+++ NEW SUPERCLASS: java.lang.Object
+++ NEW METHOD: PUBLIC(+) STATIC(+) char[] chars(int)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-change Changes to public API surface area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants