You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Arturo Bernal (Jira)" <ji...@apache.org> on 2026/06/07 17:11:00 UTC

[jira] [Commented] (HTTPCLIENT-2423) Support trace context header propagation in httpclient5-observation

    [ https://issues.apache.org/jira/browse/HTTPCLIENT-2423?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18086754#comment-18086754 ] 

Arturo Bernal commented on HTTPCLIENT-2423:
-------------------------------------------

Hi [~philsttr] 

I have opened a [PR|https://github.com/apache/httpcomponents-client/pull/839] with a proposed fix for HTTPCLIENT-2423.

The change adds a Micrometer sender observation context for both classic and async execution interceptors, exposing the outbound request as the carrier and using {{setHeader}} for propagated headers. I also added tests to verify that a tracing handler can inject {{traceparent}} and overwrite an existing stale value.

Could you please validate whether this fixes the propagation issue on your side?

Thanks,
Arturo
 

> Support trace context header propagation in httpclient5-observation
> -------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-2423
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-2423
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: HttpClient (classic)
>    Affects Versions: 5.6.1
>            Reporter: Phil Clay
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> The httpclient5-observation module does not provide a mechanism for propagating tracing headers (e.g. {{{}traceparent{}}}) in outbound requests.
> For reference, the old (deprecated) httpclient5 micrometer observation instrumentation in the micrometer-core library [provided a context so that headers would be propagated|https://github.com/micrometer-metrics/micrometer/blob/e11e7c6b3e579c607393905732d3b9b1f5863e95/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/httpcomponents/hc5/ApacheHttpClientContext.java#L60-L62].
> The instrumentation from micrometer-core has been [deprecated in favor of the instrumentation provided by httpclient5-observation|https://github.com/micrometer-metrics/micrometer/issues/7158].
> Unfortunately, the httpclient5-observation instrumentation does not propagate trace context via headers. Therefore, users switching from micrometer-core to httpclient5-observation will lose functionality.
> This enhancement request is to add the appropriate context and header propagation mechanism to the httpclient5-observation module, so that users migrating from micrometer-core instrumentation to httpclient5-observation instrumentation will retain header propagation functionality.   The old instrumentation from micrometer-core could be used as a reference for implementation  (although, I would prefer if it called setHeader instead of addHeader).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org