Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align GrpcSender contract with HttpSender #6658

Merged
merged 3 commits into from
Sep 5, 2024

Conversation

jack-berg
Copy link
Member

I was reviewing #6645 I was cringing at inconsistencies between GrpcSender and HttpSender.

  • GrpcSender has void send(T request, Runnable onSuccess, BiConsumer<GrpcResponse, Throwable> onError)
  • HttpSender has void send(Marshaler marshaler, int contentLength, Consumer<Response> onResponse, Consumer<Throwable> onError);

HttpSender got it right by cleanly separating out the difference between an export request that received a response, and one that ended exceptionally. Its up to the caller HttpExporter to evaluate the response and decide whether it was a success or error response. For GrpcSender, these are muddied together in a BiConsumer<GrpcResponse, Throwable>.

For #6645, when export attempts fail, we want to include exception in the CompletableResultCode which allow the caller to interpret what happened. Cleanly delineating between when a export failed but received a response, and failed exceptionally makes for a much cleaner API and user experience.

@jack-berg jack-berg requested a review from a team August 20, 2024 16:45
Copy link

codecov bot commented Aug 20, 2024

Codecov Report

Attention: Patch coverage is 81.25000% with 12 lines in your changes missing coverage. Please review.

Project coverage is 90.00%. Comparing base (71124d2) to head (95d8fbb).
Report is 18 commits behind head on main.

Files with missing lines Patch % Lines
...pc/managedchannel/internal/UpstreamGrpcSender.java 42.85% 4 Missing and 4 partials ⚠️
...telemetry/exporter/internal/http/HttpExporter.java 86.36% 2 Missing and 1 partial ⚠️
...telemetry/exporter/internal/grpc/GrpcExporter.java 96.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6658      +/-   ##
============================================
- Coverage     90.10%   90.00%   -0.10%     
- Complexity     6287     6358      +71     
============================================
  Files           698      703       +5     
  Lines         18978    19145     +167     
  Branches       1861     1889      +28     
============================================
+ Hits          17100    17232     +132     
- Misses         1305     1334      +29     
- Partials        573      579       +6     

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

void send(T request, Runnable onSuccess, BiConsumer<GrpcResponse, Throwable> onError);
void send(T request, Consumer<GrpcResponse> onResponse, Consumer<Throwable> onError);
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, this is a good catch.

Copy link
Contributor

@breedx-splk breedx-splk left a comment

Choose a reason for hiding this comment

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

Looks good, I like the alignment. I had a few small suggestions, but nothing to block this. Thanks!

@jack-berg jack-berg merged commit 1f6de35 into open-telemetry:main Sep 5, 2024
18 checks passed
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.

2 participants