Cannot cutomize instrumented HttpAsyncClient connection pool
mihalyr opened this issue · 2 comments
I would like to create an instrumented HttpAsyncClient (httpclient5) with custom connection pool size.
-
If I use InstrumentedHttpAsyncClients.custom, I can't prevent it to build the default instrumented pool and it already registers the metrics for it.
-
If I build my own client and pass my own instance of
InstrumentedAsyncClientConnectionManager
, that works for the connection pool, but then I need to write my ownInstrumentedAsyncExecChainHandler
because it is package private, it is a very simple wrapper class, so not a big deal as a workaround for now, just, would be nice if we could reuse that you already have there.
What would be a good way of solving this?
The simplest "fix" for my issue would be to make InstrumentedAsyncExecChainHandler
public, so we can just reuse it from there, but since it is package private, probably there was a reason for it.
Another way might be to add a new custom
method to InstrumentedHttpAsyncClients
that does not build a default connection pool, but perhaps takes an InstrumentedAsyncClientConnectionManager as a parameter?
Please let me know what do you think and if there might be better ways to do this.
This could also enable creating a managed dropwizard-client for HttpAsyncClient from a configuration similar to HttpClientConfiguration which supports connection pool configuration.
@mihalyr Thanks for bringing this up and your suggestions!
InstrumentedAsyncExecChainHandler
is encapsulating rather internal logic and I don't necessarily want to make it part of the public API.
So instead we'll add a version of the InstrumentedHttpAsyncClients#custom(...)
method which allows passing your own customized client connection manager.