elastic / elasticsearch

Free and Open Source, Distributed, RESTful Search Engine
https://www.elastic.co/products/elasticsearch
Other
928 stars 24.81k forks source link

Make HttpAsyncClientBuilder implementation configurable #58428

Open gquintana opened 4 years ago

gquintana commented 4 years ago

The HttpAsyncClientBuilder implementation creation is hard coded in https://github.com/elastic/elasticsearch/blob/v7.8.0/client/rest/src/main/java/org/elasticsearch/client/RestClientBuilder.java#L209

It prevents using custom implementations like Zipkin one: https://github.com/openzipkin/brave/issues/1226

I would like to be able to replace

HttpAsyncClientBuilder.create()

with

TracingHttpAsyncClientBuilder.create(tracing)
elasticmachine commented 4 years ago

Pinging @elastic/es-core-features (:Core/Features/Java High Level REST Client)

jbaiera commented 4 years ago

Is this builder something you could create and inject back to the elasticsearch client via the configuration callback interface? It would require mirroring the defaults from the client (ehhhhhh not great), and potentially wrapping any third-party user callbacks, but it could get you unblocked in the mean time?

gquintana commented 3 years ago

Yes, copying code from RestClientBuilder is a workaround, but not very satisfactory. Each time we upgrade Elasticsearch client library we must think about resynchronizing code. A better solution would be to introduce anHttpAsyncClientBuilder factory which would default to HttpAsyncClientBuilder::create and could be changed.

nilu-source commented 3 years ago

Any update on this PR?