Custom HttpClientConfigurer Code unreachable

Description

As per the documentation the HttpClientConfigurer code is not reachable therefore UUID in the log trace is not being added.

public class HttpClientConfigurer implements ElasticsearchHttpClientConfigurer {

 

 

@Override

public void configure(ElasticsearchHttpClientConfigurationContext context) {

 

HttpAsyncClientBuilder clientBuilder = context.clientBuilder();

clientBuilder.addInterceptorFirst((HttpRequestInterceptor) (request, context12) -> {

MDC.put("correlationId", UUID.randomUUID().toString());

});

clientBuilder.addInterceptorFirst((HttpResponseInterceptor) (response, context1) -> {

MDC.put("correlationId", UUID.randomUUID().toString());

});

}

 

}

 

hibernate.search.backend.client.configurer =class:com.example.configuration.HttpClientConfigurer

Note : MDC - > A Mapped Diagnostic Context, or MDC in short, is an instrument for distinguishing interleaved log output from different sources. Log output is typically interleaved when a server handles multiple clients near-simultaneously.
MDC.put("correlationId", UUID.randomUUID().toString());
adds the correlationId UUID to the logging context.

Main Goal is to generate logs with UUID for better tracing

Activity

Show:

Yoann Rodière October 23, 2023 at 12:22 PM

Closing due to lack of reproducer.

If you manage to set up a small project that reproduces the issue, please comment on this issue, reach out to the team or open another issue. Thank you.

Yoann Rodière September 28, 2022 at 6:15 PM

We have integration tests for this and they pass, so it’s impossible to know what’s going on in your case.

Please provide a reproducer, for example based on this template, and I’ll have a look.

Cannot Reproduce

Details

Assignee

Reporter

Priority

Created September 28, 2022 at 6:04 PM
Updated October 23, 2023 at 12:22 PM
Resolved October 23, 2023 at 12:22 PM