Open patpatpat123 opened 1 year ago
There currently is no support implemented in Spring Data Elasticsearch for that.
Thank you @sothawo for the clear explanation.
May I ask if it is possible to take this as enhancement, improvement request please?
@sothawo I'm also interested in this and can see the other Spring Data projects have support for this:
even a section in the spring data elastic reference on how we can override the auto configuration would be beneficial.
Thanks
As I wrote, there is no support currently in Spring Data Elasticsearch in regards to this observability topic.
In contrast to Spring Data Mongodb a Spring Data Elasticsearch is a community driven project, there is no dedicated team anywhere working on it. So this issue will be open until either a contribution from the community adds support for observability or I find time to add this. But I am doing this work in my spare time, so I can't tell when I will find to address this issue.
Just wanted to take the time to say thanks to @sothawo. I am a heavy user a spring data reactive elasticsearch and this repo makes things much easier.
I do not have the level of a contributor, but if you believe you can leave some pointers here, happy to try to come up with a PR. Regardless, looking forward to seeing this!
Hi, as an FYI this is the solution I found to add observation to Spring Data Elastic Reactive
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.binder.httpcomponents.MicrometerHttpClientInterceptor;
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.elasticsearch.client.RestClientBuilder;
import org.springframework.boot.autoconfigure.elasticsearch.RestClientBuilderCustomizer;
import org.springframework.context.annotation.Bean;
@Bean
RestClientBuilderCustomizer elasticSearchMetricsrestClientBuilderCustomizer(MeterRegistry registry) {
return new RestClientBuilderCustomizer() {
@Override
public void customize(HttpAsyncClientBuilder builder) {
MicrometerHttpClientInterceptor interceptor = new MicrometerHttpClientInterceptor(registry,
request -> request.getRequestLine().getUri(),
Tags.empty(),
true);
builder.addInterceptorFirst(interceptor.getRequestInterceptor());
builder.addInterceptorLast(interceptor.getResponseInterceptor());
}
@Override
public void customize(RestClientBuilder builder) {
// TODO Auto-generated method stub
}
};
}
import org.springframework.boot.autoconfigure.elasticsearch.RestClientBuilderCustomizer;
Adding this to Spring Data Elasticsearch would add a dependency on Spring Boot, which we cannnot do (it would create a circular dependency).
Is this possible to break the circular dependency with some other mechanism? (reflection, etc...)
Metrics and traces are quite baseline features for any production workload and having those in this project would be a great plus
That's a HUGE functionality gap since Elasticsearch in Spring Data is widely used. And that's one of the deal breakers for using the OpenTelemetry JavaAagent instead of Micrometer.
cc: @marcingrzejszczak
As I already wrote:
Spring Data Elasticsearch is a community driven project, there is no dedicated team anywhere working on it. So this issue will be open until either a contribution from the community adds support for observability or I find time to add this. But I am doing this work in my spare time, so I can't tell when I will find to address this issue.
I have a day time job, a family and some other hobbies and interests beside this project. Contributions are always welcome.
Hello Spring Data Elasticsearch team,
Wanted to start a small issue regarding a SpringBoot app, which has micrometer + actuator + Spring Data Elasticsearch please.
This issue is based on the very recent talk at SpringOne regarding Spring Data: https://springone.io/sessions/modern-persistence-with-spring-data-3 (very cool talk btw)
As you can see at 21:00 (please see screenshot), it is mentioned the Spring Data projects which are integrated with observability. Unfortunately, Elasticsearch is not present.
In order to confirm that, we have a SpringBoot app which is storing / retrieving data from Cassandra, and indeed, in our Zipkin, we could see the database interactions.
However, a similar app, where the data source is Elasticsearch, we are able to see the traces, but traces are without the interaction with Elasticsearch.
May I ask how to enable the traces with Elasticsearch please?
Thank you