You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be convenient to be able to choose a different implementation of HttpClientBuilder. For instance, opentelemetry-apache-httpclient extends HttpClientBuilder in order to override a protected method.
I propose a new property Apache5?ClientProperties.CLIENT_BUILDER. ApacheConnector would extract the object at that property, use it if it is an instance of HttpClientBuilder, and fall back to HttpClientBuilder.create() if it is absent / not an instance of HttpClientBuilder.
Happy to contribute a PR if it would be accepted in principle.
The text was updated successfully, but these errors were encountered:
Would ApacheHttpClientBuilderConfigurator be the class you seek? Just register your implementation to the client and you may configure the HttpClientBuilder there.
By that stage all the configuration of the HttpClientBuilder has been done, so while it is possible to return a different instance of a subtype of HttpClientBuilder from an ApacheHttpClientBuilderConfigurator, the implementation has to copy all the previous configuration onto it, which seems arduous and error prone.
I see. There are multiple possibilities how to implement this.
If a property, I assume it would better be a supplier of the HttpClientBuilder.
Other option is to extend the Apache5HttpClientBuilderConfigurator by a create() method that would be invoked the first before configuring the builder.
Not sure which one is better at the moment. The latter seems more consistent, but would cause issues when multiple registered. They could be sorted by Priority, though. The first brings another property, but for a supplier this time. Not as type-safe as the interface option.
Currently both the 4.x & 5.x Apache Connector Providers hard code the creation of the
HttpClientBuilder
.4.x connector (3.1 branch):
5.x connnector (4.0 branch):
It would be convenient to be able to choose a different implementation of
HttpClientBuilder
. For instance, opentelemetry-apache-httpclient extendsHttpClientBuilder
in order to override a protected method.I propose a new property
Apache5?ClientProperties.CLIENT_BUILDER
.ApacheConnector
would extract the object at that property, use it if it is an instance ofHttpClientBuilder
, and fall back toHttpClientBuilder.create()
if it is absent / not an instance ofHttpClientBuilder
.Happy to contribute a PR if it would be accepted in principle.
The text was updated successfully, but these errors were encountered: