Skip to content

Avoid shared internal code in sender-jdk and trace-propagators - #9039

Open
rooks-ns wants to merge 1 commit into
open-telemetry:mainfrom
rooks-ns:fix/avoid-shared-internal-senders
Open

rooks-ns wants to merge 1 commit into
open-telemetry:mainfrom
rooks-ns:fix/avoid-shared-internal-senders

Conversation

@rooks-ns

@rooks-ns rooks-ns commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Description

Addresses #6970 by un-exempting sender and propagator modules from NoSharedInternalCodeTest:

  • Relocated cross-module shared utilities to canonical *.impl packages with @OtelImplJavadoc and regenerated jApiCmp baselines:
    • RetryUtil -> io.opentelemetry.exporter.impl (opentelemetry-exporter-common)
    • DaemonThreadFactory -> io.opentelemetry.sdk.common.impl (opentelemetry-sdk-common)
    • TlsUtil -> io.opentelemetry.exporter.impl (opentelemetry-exporter-common)
  • Removed unused Marshaler internal import in GrpcRequestBody (opentelemetry-exporter-sender-okhttp).
  • Un-exempted artifacts in NoSharedInternalCodeTest:
    • opentelemetry-exporter-sender-jdk
    • opentelemetry-extension-trace-propagators
    • opentelemetry-exporter-sender-okhttp

Related Issues

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

otelbot Bot commented Nov 14, 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-sdk-common

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

@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Waiting on the author · refreshed 2026-11-30 23:08 UTC

Respond to 5 review items (e.g. link a commit, explain why not, ask a follow-up):

  • Inline threads: 1, 2, 3, 4, 5
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 Nov 14, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.38202% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.55%. Comparing base (a92b644) to head (6ac369c).

Files with missing lines Patch % Lines
...entelemetry/exporter/internal/TlsConfigHelper.java 66.66% 2 Missing ⚠️
...telemetry/sdk/common/impl/DaemonThreadFactory.java 91.66% 1 Missing and 1 partial ⚠️
...ntelemetry/sdk/common/export/HttpSenderConfig.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9039      +/-   ##
============================================
- Coverage     90.56%   90.55%   -0.02%     
- Complexity    11220    11226       +6     
============================================
  Files          1032     1034       +2     
  Lines         30599    30616      +17     
  Branches       4010     4007       -3     
============================================
+ Hits          27711    27723      +12     
- Misses         1913     1918       +5     
  Partials        975      975              

☔ 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.

@rooks-ns
rooks-ns marked this pull request as ready for review November 15, 2026 08:45
@rooks-ns
rooks-ns requested a review from a team as a code owner November 15, 2026 08:45

@abdessattar23 abdessattar23 left a comment

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.

I went through the refactoring and the overall direction looks consistent with the *.impl convention and #6970.

One compatibility concern: relocating RetryUtil, TlsUtil, and DaemonThreadFactory removes their previous internal binary names. Older sender/SDK artifacts paired with newer common artifacts can therefore encounter NoClassDefFoundError. I realize internal APIs aren't covered by semver guarantees, but given the version-alignment motivation of #6970, would it make sense to retain delegating compatibility shims, or is that one-time break intentional?

Also, now that these classes are part of the stable impl API surface, a few public constructors and methods need complete Javadocs, notably DaemonThreadFactory(String), TlsUtil.keyManager, TlsUtil.trustManager, and RetryUtil.retryAfterNanos

@rooks-ns

Copy link
Copy Markdown
Contributor Author

@abdessattar23 Yes. It is intentional.

@opentelemetry-pr-dashboard

Copy link
Copy Markdown

Hi @rooks-ns — just a friendly reminder that this pull request is waiting on you. The dashboard status comment has the open items and is kept current.

  • Replying is enough to hand it off — answer, explain why no change is needed, or ask a follow-up. The dashboard routes it onward once nothing on the list is waiting on you.
  • To hand it back for any other reason, including the dashboard getting this wrong, comment /dashboard route:reviewers.

@jack-berg jack-berg left a comment

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.

Thanks - couple of comments, but this is long overdue. 🙂

Comment on lines +39 to +40
* <p>This class is not intended for use by application developers. Its API is stable and will not
* be changed or removed in a backwards-incompatible manner.

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.

Could we resolve the default trust manager in TlsConfigHelper and pass it alongside the SSL context through HttpSenderConfig / GrpcSenderConfig, instead of making TlsUtil.defaultTrustManager() stable? Those interfaces already promise a non-null trust manager when the context is non-null. Initializing the context with that manager would satisfy the contract and avoid delegating this default to individual senders.

*/

package io.opentelemetry.exporter.internal;
package io.opentelemetry.exporter.impl;

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.

Could TlsUtil.keyManager and TlsUtil.trustManager stay internal? Their only production caller is TlsConfigHelper, in this module. The other callers are tests, which can use shared internal code without requiring a stable API commitment.

Comment on lines +24 to +25
* This class is not intended for use by application developers. Its API is stable and will not be
* changed or removed in a backwards-incompatible manner.

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.

retryableGrpcStatusCodes() and retryableHttpResponseCodes() encode OTLP retry policy, but the senders are not restricted to OTLP. Rather than stabilizing these as generic retry utilities, could we pass retryable status codes through HttpSenderConfig / GrpcSenderConfig and have the OTLP implementations supply the OTLP-specific sets? Any new configuration methods would need compatibility-preserving defaults.

*/

package io.opentelemetry.exporter.internal;
package io.opentelemetry.exporter.impl;

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.

Making retryAfterNanos stable makes sense, but could it live in sdk:common, alongside the sender SPI in io.opentelemetry.sdk.common.export, under an HTTP-specific utility name? Parsing Retry-After is HTTP transport functionality, not exporter-specific policy.

Comment on lines +17 to +18
* <p>This class is not intended for use by application developers. Its API is stable and will not
* be changed or removed in a backwards-incompatible manner.

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.

Moving this to impl makes sense. Before stabilizing the constructors, could we replace them with static factories, e.g. create(namePrefix) and createWithDelegate(namePrefix, delegate)? Named factories let us express the purpose of each creation variant without committing to constructor overloads.

@jkwatson jkwatson left a comment

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.

I'm ok with the changes in the impl packages if Jack is ok with them

@rooks-ns
rooks-ns force-pushed the fix/avoid-shared-internal-senders branch 2 times, most recently from 6b30bd4 to bf6c611 Compare November 27, 2026 21:09
…opagators

- Relocate DaemonThreadFactory to io.opentelemetry.sdk.common.impl with private constructors and static factory methods, retaining a @deprecated bridge in sdk.common.internal for binary backward-compatibility
- Add HttpExportUtil.retryAfterNanos to sdk:common and remove sender-jdk dependency on exporters:common
- Pass retryable HTTP and gRPC status codes through HttpSenderConfig and GrpcSenderConfig, with OTLP configs supplying the canonical status code sets
- Resolve default trust manager statelessly in TlsConfigHelper, keeping TlsUtil internal without state mutation
- Remove sender-okhttp production dependency on exporters:common
- Un-exempt sender-jdk, sender-okhttp, and trace-propagators from NoSharedInternalCodeTest
@rooks-ns
rooks-ns force-pushed the fix/avoid-shared-internal-senders branch from bf6c611 to 6ac369c Compare November 27, 2026 23:26
@rooks-ns
rooks-ns requested a review from jack-berg November 29, 2026 19:47
private final long maxResponseBodySize;

/** Create a sender. */
/** Create a sender with custom retryable status codes. */

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.

#nit its silly to specify "with custom retryable status codes" since that suggests we should "and custom " for every argument accepted in the constructor.

Comment on lines +122 to +123
try {
return TlsUtil.defaultTrustManager();

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.

Could we resolve the SSL context and default trust manager as a pair once per build? getSslContext() calls getTrustManager() internally, then exporter construction calls getTrustManager() again. With no explicit manager configured, these resolve separate instances rather than passing the manager used to initialize the context. This also repeats default trust-store initialization. The resolved pair should not prevent subsequent builder configuration.

Comment on lines +70 to +72
@Override
public Set<GrpcStatusCode> getRetryableGrpcStatusCodes() {
return RetryUtil.retryableGrpcStatusCodeEnums();

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.

Could both ImmutableGrpcSenderConfig and ImmutableHttpSenderConfig inherit the interface defaults instead of overriding them to call RetryUtil? The defaults already contain the same OTLP retryable codes. We could then remove RetryUtil and its tests after updating the remaining test-infrastructure caller, ManagedChannelTelemetryExporterBuilder, to obtain the codes from a sender config. This avoids maintaining duplicate lists.

Comment on lines +17 to +20
*
* @deprecated Use {@link io.opentelemetry.sdk.common.impl.DaemonThreadFactory} instead.
*/
@Deprecated

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.

Could we remove the old internal class and its compatibility test instead of retaining a deprecated forwarding shim? Internal APIs have no compatibility guarantees, so this can simply move to impl with the new factories.

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.

4 participants