Skip to content

Suppress instrumentation of exporter requests in JdkHttpSender - #8757

Draft
thswlsqls wants to merge 1 commit into
open-telemetry:mainfrom
thswlsqls:fix/jdk-http-sender-suppress-instrumentation
Draft

Suppress instrumentation of exporter requests in JdkHttpSender#8757
thswlsqls wants to merge 1 commit into
open-telemetry:mainfrom
thswlsqls:fix/jdk-http-sender-suppress-instrumentation

Conversation

@thswlsqls

Copy link
Copy Markdown
Contributor

Fixes #8755

Description

  • Wrap the request submission in JdkHttpSender.send() with InstrumentationUtil.suppressInstrumentation(...), so the OpenTelemetry Java agent does not record the exporter's own OTLP requests as CLIENT spans.
  • Mirrors OkHttpHttpSender.send(), the other HttpSender implementation, which already wraps its call the same way.
  • The flag is set on the calling thread's Context; the agent's executor instrumentation carries it to the sending thread. The okhttp sender relies on the same mechanism when it hands the call to the dispatcher.
  • Suppression was added for the okhttp sender in Identifying otel http calls #5918; the JDK sender was never covered by the follow-up work.
  • The grpc sender (UpstreamGrpcSender) still lacks suppression. Left for a separate PR.

Testing done

  • Added JdkHttpSenderTest#send_suppressesInstrumentation: it injects a Context.taskWrapping(...) executor to stand in for the agent's context propagation and asserts shouldSuppressInstrumentation is true on the sending thread. It fails without the production change and passes with it.
  • ./gradlew :exporters:sender:jdk:check — 14 tests passed.
  • No docs/apidiffs change: the class lives in an internal package, which japicmp excludes.

@codecov

codecov Bot commented Aug 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.29%. Comparing base (e2efec5) to head (0a8594d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #8757   +/-   ##
=========================================
  Coverage     91.29%   91.29%           
- Complexity    10498    10501    +3     
=========================================
  Files          1006     1006           
  Lines         28338    28340    +2     
  Branches       3581     3581           
=========================================
+ Hits          25870    25874    +4     
  Misses         1675     1675           
+ Partials        793      791    -2     

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

@opentelemetry-pr-dashboard

Copy link
Copy Markdown

Pull request dashboard status

Waiting on the author · refreshed 2026-09-02 14:35 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.

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 does not suppress instrumentation of exporter requests

1 participant