Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

apache httpclient 5 - http calls done in interceptors not instrumented

Open
#10,383 0 comments 0 reactions 1 assignee View on GitHub

@vandonr is already working on this.

Since Feb 17, 2026.

Assessment

This issue has not been assessed yet.

Description

inst: apache httpcomponents type: bug report
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from DataDog/dd-trace-java

All issues in DataDog/dd-trace-java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.