We recently upgraded our service backend from Elasticsearch to Opensearch. The elasticsearch client used the apache HttpClient and HttpClientBuilder to make http calls. I was able to use the aws xray TracedHttpClient in the client chain in order to trace all http requests made to Elasticsearch, as shown below
@Override
protected HttpClientBuilder configureHttpClient(HttpClientBuilder builder) {
return new HttpClientBuilder() {
@Override
public CloseableHttpClient build() {
return new TracedHttpClient(builder.build());
}
};
}
However, the Opensearch java clients use the apache HttpAsyncClient and HttpAsyncClientBuilder, which is incompatible with the TracedHttpClient.
Other than making my own implementation of a TracedHttpAsyncClient, is there any other way to add xray tracing through an HttpAsyncClient for every request?
Thanks for the suggestions! I'll look into using ADOT and see if that can solve our problems