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

Return status code exceptions via CompletableResultCode in GrpcExporter and HttpExporter #6645

Merged

Conversation

jarrodrobins
Copy link
Contributor

Building off of @jack-berg's PR #6348, this PR uses the newly added CompletableResultCode's failExceptionally method to return status code errors from the GrpcExporter and HttpExporter.

The intention is to expose the status code upstream so it can be responded to, rather than simply have an 'unknown' failure. This was requested #6306. There was some discussion there around parsing response bodies which sounded like it was quite complicated; I have just focused on the basic case of returning the HTTP or GRPC status code.

This is my first PR into OpenTelemetry so please let me know if what I've done should be done differently or if you have suggestions for a better way.

I initially had separate exceptions for the GrpcExporter and HttpExporters, but this seemed like overkill considering they did the same thing. Additionally, I wasn't sure if there was a better package for the exception itself - I've put it in the internal package currently with the associated code.

Please take a look - happy to make changes as necesssary.

@jarrodrobins jarrodrobins requested a review from a team August 13, 2024 05:05
Copy link

linux-foundation-easycla bot commented Aug 13, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

Copy link

codecov bot commented Aug 13, 2024

Codecov Report

Attention: Patch coverage is 92.85714% with 3 lines in your changes missing coverage. Please review.

Project coverage is 90.09%. Comparing base (7522bfe) to head (039ca4c).
Report is 1 commits behind head on main.

Files Patch % Lines
...telemetry/exporter/internal/grpc/GrpcExporter.java 80.00% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               main    #6645   +/-   ##
=========================================
  Coverage     90.09%   90.09%           
- Complexity     6280     6287    +7     
=========================================
  Files           697      698    +1     
  Lines         18951    18978   +27     
  Branches       1858     1861    +3     
=========================================
+ Hits          17073    17099   +26     
  Misses         1305     1305           
- Partials        573      574    +1     

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

@jarrodrobins jarrodrobins force-pushed the return-exceptions-from-exporters branch from d169788 to 0e19a77 Compare August 20, 2024 02:05
@jarrodrobins
Copy link
Contributor Author

Thanks @jack-berg, I've updated my PR to include your suggestion. I also broke out the logging into a separate method. Take a look, I think I'm handling the gRPC error codes correctly (I looked at what OkHttpGrpcSender was doing). Let me know if you need me to make any other changes.

Copy link
Member

@jack-berg jack-berg left a comment

Choose a reason for hiding this comment

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

Just a couple of small comments but this looks pretty good. Thanks!

@jarrodrobins
Copy link
Contributor Author

Thanks @jack-berg, I've made those changes.

@jarrodrobins jarrodrobins force-pushed the return-exceptions-from-exporters branch from b5557f4 to 039ca4c Compare August 27, 2024 01:52
@jack-berg jack-berg merged commit 71124d2 into open-telemetry:main Aug 27, 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