Skip to content

Conversation

@jack-berg
Copy link
Member

Contributes to #8001 by refactoring JaegerRemoteSampler to be built on top of the newly public sender APIs.

This simplifies the code, and allows JaegerRemoteSampler to be able to automatically take advantage of breaking out opentelemetry-exporter-sender-okhttp into separate versions for okhttp 4.x and 5.x.

@jack-berg jack-berg requested a review from a team as a code owner February 4, 2026 22:57
public String toString() {
return toString(true);
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Just moving this code to a more neutral SenderUtil class since its now being used outside GrpcExporterBuilder.

import org.junit.jupiter.api.extension.RegisterExtension;
import org.junitpioneer.jupiter.SetSystemProperty;

class GrpcExporterTest {
Copy link
Member Author

Choose a reason for hiding this comment

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

Moved to SenderUtilTest

return new byte[] {}; // TODO: drain input to byte array
public byte[] parse(InputStream inputStream) {
try {
int bufLen = 4 * 0x400; // 4KB
Copy link
Member Author

Choose a reason for hiding this comment

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

Lifted from the now-deleted MarshallerRemoteSamplerServiceGrpc.

}));
}

private static byte[] getResponseMessageBytes(byte[] bodyBytes) throws IOException {
Copy link
Member Author

Choose a reason for hiding this comment

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

Lifted from the now-deleted OkHttpGrpcService

@codecov
Copy link

codecov bot commented Feb 4, 2026

Codecov Report

❌ Patch coverage is 84.16667% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.26%. Comparing base (fff95e0) to head (e876071).

Files with missing lines Patch % Lines
...pc/managedchannel/internal/UpstreamGrpcSender.java 44.44% 9 Missing and 1 partial ⚠️
...orter/sender/okhttp/internal/OkHttpGrpcSender.java 57.14% 5 Missing and 1 partial ⚠️
...sion/trace/jaeger/sampler/JaegerRemoteSampler.java 90.62% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8046      +/-   ##
============================================
+ Coverage     90.20%   90.26%   +0.06%     
+ Complexity     7592     7565      -27     
============================================
  Files           841      839       -2     
  Lines         22911    22787     -124     
  Branches       2288     2271      -17     
============================================
- Hits          20666    20569      -97     
+ Misses         1529     1510      -19     
+ Partials        716      708       -8     

☔ View full report in Codecov by Sentry.
📢 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.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request refactors JaegerRemoteSampler to use the public sender APIs (GrpcSender and GrpcSenderProvider) instead of maintaining its own internal HTTP client implementations. This change addresses issue #8001 regarding OkHttp compatibility, allowing the sampler to automatically benefit from separate versions of opentelemetry-exporter-sender-okhttp for OkHttp 4.x and 5.x.

Changes:

  • Replaced internal OkHttpGrpcService and UpstreamGrpcService classes with the public GrpcSender API
  • Converted JaegerRemoteSampler from synchronous to asynchronous callback-based communication
  • Extracted common sender resolution logic into a new SenderUtil class shared between GrpcExporterBuilder and HttpExporterBuilder

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
JaegerRemoteSampler.java Refactored to use GrpcSender with async callbacks instead of synchronous GrpcService execution
JaegerRemoteSamplerBuilder.java Updated to resolve and create GrpcSender using GrpcSenderProvider instead of building custom HTTP clients
OkHttpGrpcService.java Deleted - functionality moved to OkHttpGrpcSender
UpstreamGrpcService.java Deleted - functionality exists in UpstreamGrpcSender
GrpcService.java Deleted - replaced by public GrpcSender interface
MarshallerRemoteSamplerServiceGrpc.java Deleted - no longer needed with sender abstraction
SamplingStrategyResponseUnMarshaler.java Simplified to static read() method, removing stateful instance pattern
OkHttpGrpcSender.java Added response message extraction logic from deleted OkHttpGrpcService
UpstreamGrpcSender.java Added input stream parsing implementation for response messages
SenderUtil.java New utility class consolidating sender provider resolution logic
GrpcExporterBuilder.java Refactored to delegate sender resolution to SenderUtil
HttpExporterBuilder.java Refactored to delegate sender resolution to SenderUtil
ManagedChannelUtil.java Removed shutdownChannel() method (now handled by senders)
ImmutableGrpcSenderConfig.java Made public to support external usage by JaegerRemoteSamplerBuilder
build.gradle.kts (jaeger-remote-sampler) Removed direct OkHttp dependency, added test configuration for GrpcSenderProvider
build.gradle.kts (exporters/common) Reorganized test suites to consolidate sender provider tests
Test files Updated to reflect field name changes (delegategrpcSender) and use GrpcStatusCode enum

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant