Align GrpcSender contract with HttpSender#6658
Merged
jack-berg merged 3 commits intoSep 5, 2024
Merged
Conversation
Codecov ReportAttention: Patch coverage is
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. |
…y-java into fix-grpcsender-interface
breedx-splk
reviewed
Sep 5, 2024
| public interface GrpcSender<T extends Marshaler> { | ||
|
|
||
| void send(T request, Runnable onSuccess, BiConsumer<GrpcResponse, Throwable> onError); | ||
| void send(T request, Consumer<GrpcResponse> onResponse, Consumer<Throwable> onError); |
Contributor
There was a problem hiding this comment.
Yeah, this is a good catch.
breedx-splk
reviewed
Sep 5, 2024
breedx-splk
reviewed
Sep 5, 2024
breedx-splk
reviewed
Sep 5, 2024
breedx-splk
reviewed
Sep 5, 2024
breedx-splk
approved these changes
Sep 5, 2024
breedx-splk
left a comment
Contributor
There was a problem hiding this comment.
Looks good, I like the alignment. I had a few small suggestions, but nothing to block this. Thanks!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I was reviewing #6645 I was cringing at inconsistencies between GrpcSender and HttpSender.
void send(T request, Runnable onSuccess, BiConsumer<GrpcResponse, Throwable> onError)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
CompletableResultCodewhich 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.