apache httpclient 5 - http calls done in interceptors not instrumented
@vandonr is already working on this.
Since Feb 17, 2026.
Assessment
This issue has not been assessed yet.
Description
Tracer Version(s)
1.57.0
Java Version(s)
25
JVM Vendor
Eclipse Adoptium / Temurin
Bug Report
When using apache httpclient v5, it is possible to do http requests from with exec interceptors (type org.apache.hc.client5.http.classic.ExecChainHandler) added on a http client. This is e.g. useful for fetching a token to add it as a header on a requests. The requests done in such an interceptor are not instrumented because of this if. Would it be possible to fix this, so that traces do not miss http calls?
Expected Behavior
All http calls are recorded in the trace, even when they are executed from within an interceptor.
Reproduction Code
try(CloseableHttpClient httpClient = HttpClientBuilder.create()
.addExecInterceptorLast("interceptor", (request, scope, chain) -> {
CloseableHttpClient tokenHttpClient = HttpClientBuilder.create().build();
String token = tokenHttpClient.execute(new HttpGet("..."), resp -> {
// ...
return fetchedToken;
});
request.addHeader("x-token", token);
return chain.proceed(request, scope);
})
.build()) {
httpClient.execute(new HttpGet("..."), response -> {
// ...
return null;
});
}
- Dominant language
- Java
- Stars
- 737
- Forks
- 361
- Avg merge
- 3d 20h
- Merged PRs (30d)
- 173
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from DataDog/dd-trace-java
-
type: feature request
Difficulty 1/5 1-3 hours Newbie friendliness 70/100
DataDog/dd-trace-java#10245 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 62/100
DataDog/dd-trace-java#12608 ·
-
type: bug report
Difficulty 4/5 3-5 days Newbie friendliness 35/100
DataDog/dd-trace-java#12597 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
DataDog/dd-trace-java#12540 · 4 comments · 1 assignee ·
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
DataDog/dd-trace-java#12480 ·
All issues in DataDog/dd-trace-java
Similar issues
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
inu-appcenter/memorIN-backend#288 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
frontend maui-pilot pilot-ask question
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
area/plugin
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
kestra-io/plugin-kestra#190 ·