Skip to content

Pass the original exception to onError in JdkHttpSender - #8963

Draft
thswlsqls wants to merge 1 commit into
open-telemetry:mainfrom
thswlsqls:fix/jdk-sender-unwrap-completion-exception
Draft

thswlsqls wants to merge 1 commit into
open-telemetry:mainfrom
thswlsqls:fix/jdk-sender-unwrap-completion-exception

Conversation

@thswlsqls

Copy link
Copy Markdown
Contributor

Fixes #8961

Description

  • JdkHttpSender.send() forwarded the whenComplete throwable as-is, so onError received CompletionException(UncheckedIOException(IOException)). HttpExporter then recorded error.type=java.util.concurrent.CompletionException and used the wrapper as the logged exception and the FailedExportException cause.
  • A private unwrap helper now strips one CompletionException layer, then one UncheckedIOException layer. Other exceptions pass through unchanged.
  • For transport failures (connection refused, timeouts, TLS errors) onError now gets the same IOException as with OkHttpHttpSender. The RejectedExecutionException path in send() already did this.
  • Out of scope: for body-too-large and unsupported-encoding failures, error.type is now the private IOException subclass name; OkHttp reports java.io.IOException.

Testing done

  • JdkHttpSenderTest#send_ioException_callsOnError now asserts onError receives the thrown IOException (isSameAs) instead of checking the root cause. With the fix reverted it fails with CompletionException: java.io.UncheckedIOException: java.io.IOException: send failed.
  • :exporters:sender:jdk:check: spotless, ErrorProne/NullAway and jApiCmp pass; 13 of 14 tests pass. sendInternal_RetryableConnectTimeoutException also fails on unmodified main here: it needs 10.255.255.1 to time out, and my VPN routes it.
  • :exporters:otlp:all:testJdkHttpSender: 143 tests pass.

@opentelemetry-pr-dashboard

Copy link
Copy Markdown

Pull request dashboard status

Waiting on the author · refreshed 2026-10-18 13:08 UTC

Move out of draft to request review.

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.
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

@codecov

codecov Bot commented Oct 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.41%. Comparing base (b32298a) to head (f74704e).

Files with missing lines Patch % Lines
...ry/exporter/sender/jdk/internal/JdkHttpSender.java 71.42% 0 Missing and 2 partials ⚠️

❌ Your patch check has failed because the patch coverage (71.42%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #8963   +/-   ##
=========================================
  Coverage     90.40%   90.41%           
- Complexity    10898    10900    +2     
=========================================
  Files          1015     1015           
  Lines         29843    29849    +6     
  Branches       3896     3898    +2     
=========================================
+ Hits          26981    26988    +7     
+ Misses         1910     1909    -1     
  Partials        952      952           

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

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JdkHttpSender passes CompletionException instead of the original exception to onError

1 participant