Polishing
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
* Upgrade to Elasticsearch 9.3.1
|
||||
* Add support to use `IndexCoordinates` as repository query parameter
|
||||
* Add support for includeNamedQueriesScore in Query
|
||||
* Add support for Micrometer observation.
|
||||
|
||||
[[new-features.6-0-0]]
|
||||
== New in Spring Data Elasticsearch 6.0
|
||||
|
||||
+4
-6
@@ -15,11 +15,11 @@
|
||||
*/
|
||||
package org.springframework.data.elasticsearch.client.elc;
|
||||
|
||||
import io.micrometer.observation.Observation;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates;
|
||||
|
||||
import io.micrometer.observation.Observation;
|
||||
|
||||
/**
|
||||
* {@link Observation.Context} for Spring Data Elasticsearch operations. One instance is created per observed operation.
|
||||
* It carries contextual data that conventions use to produce observation names and key-values.
|
||||
@@ -30,10 +30,8 @@ import io.micrometer.observation.Observation;
|
||||
public class ElasticsearchObservationContext extends Observation.Context {
|
||||
|
||||
private final ElasticsearchOperationName operationName;
|
||||
@Nullable
|
||||
private final IndexCoordinates indexCoordinates;
|
||||
@Nullable
|
||||
private Integer batchSize;
|
||||
@Nullable private final IndexCoordinates indexCoordinates;
|
||||
@Nullable private Integer batchSize;
|
||||
|
||||
public ElasticsearchObservationContext(ElasticsearchOperationName operationName,
|
||||
@Nullable IndexCoordinates indexCoordinates) {
|
||||
|
||||
+12
-13
@@ -15,6 +15,17 @@
|
||||
*/
|
||||
package org.springframework.data.elasticsearch.core;
|
||||
|
||||
import io.micrometer.observation.ObservationRegistry;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
@@ -51,17 +62,6 @@ import org.springframework.data.util.Streamable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import io.micrometer.observation.ObservationRegistry;
|
||||
|
||||
/**
|
||||
* This class contains methods that are common to different implementations of the {@link ElasticsearchOperations}
|
||||
* interface that use different clients, like the different Java clients from Elasticsearch or some external
|
||||
@@ -194,8 +194,7 @@ public abstract class AbstractElasticsearchTemplate implements ElasticsearchOper
|
||||
*
|
||||
* @param copy the new template instance to customize
|
||||
*/
|
||||
protected void customizeCopy(AbstractElasticsearchTemplate copy) {
|
||||
}
|
||||
protected void customizeCopy(AbstractElasticsearchTemplate copy) {}
|
||||
|
||||
/**
|
||||
* logs the versions of the different Elasticsearch components.
|
||||
|
||||
+14
-16
@@ -15,6 +15,18 @@
|
||||
*/
|
||||
package org.springframework.data.elasticsearch.core;
|
||||
|
||||
import io.micrometer.observation.ObservationRegistry;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.core.publisher.Sinks;
|
||||
import reactor.util.function.Tuple2;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.reactivestreams.Subscriber;
|
||||
import org.reactivestreams.Subscription;
|
||||
@@ -48,18 +60,6 @@ import org.springframework.data.elasticsearch.support.VersionInfo;
|
||||
import org.springframework.data.mapping.callback.ReactiveEntityCallbacks;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import io.micrometer.observation.ObservationRegistry;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.core.publisher.Sinks;
|
||||
import reactor.util.function.Tuple2;
|
||||
|
||||
/**
|
||||
* Base class keeping common code for implementations of the {@link ReactiveElasticsearchOperations} interface
|
||||
* independent of the used client.
|
||||
@@ -185,8 +185,7 @@ abstract public class AbstractReactiveElasticsearchTemplate
|
||||
*
|
||||
* @param copy the new template instance to customize
|
||||
*/
|
||||
protected void customizeCopy(AbstractReactiveElasticsearchTemplate copy) {
|
||||
}
|
||||
protected void customizeCopy(AbstractReactiveElasticsearchTemplate copy) {}
|
||||
|
||||
/**
|
||||
* logs the versions of the different Elasticsearch components.
|
||||
@@ -285,8 +284,7 @@ abstract public class AbstractReactiveElasticsearchTemplate
|
||||
sink.tryEmitComplete();
|
||||
}
|
||||
})
|
||||
.subscribe(v -> {
|
||||
}, error -> {
|
||||
.subscribe(v -> {}, error -> {
|
||||
if (subscription != null) {
|
||||
subscription.cancel();
|
||||
}
|
||||
|
||||
+4
-4
@@ -17,14 +17,14 @@ package org.springframework.data.elasticsearch.client.elc;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates;
|
||||
|
||||
import io.micrometer.common.KeyValue;
|
||||
import io.micrometer.common.KeyValues;
|
||||
import io.micrometer.observation.Observation;
|
||||
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link DefaultElasticsearchObservationConvention}.
|
||||
*
|
||||
|
||||
+8
-8
@@ -17,20 +17,20 @@ package org.springframework.data.elasticsearch.client.elc;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import io.micrometer.common.docs.KeyName;
|
||||
import io.micrometer.observation.Observation;
|
||||
import io.micrometer.observation.ObservationRegistry;
|
||||
import io.micrometer.observation.tck.TestObservationRegistry;
|
||||
import io.micrometer.observation.tck.TestObservationRegistryAssert;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates;
|
||||
|
||||
/**
|
||||
* Tests for {@link ElasticsearchObservation} and the end-to-end observation lifecycle.
|
||||
*
|
||||
|
||||
+4
-2
@@ -140,8 +140,10 @@ class ObservabilityIntegrationTests {
|
||||
|
||||
@Document(indexName = "#{@indexNameProvider.indexName()}")
|
||||
static class SampleEntity {
|
||||
@Nullable @Id private String id;
|
||||
@Nullable @Field(type = FieldType.Text) private String message;
|
||||
@Nullable
|
||||
@Id private String id;
|
||||
@Nullable
|
||||
@Field(type = FieldType.Text) private String message;
|
||||
|
||||
@Nullable
|
||||
public String getId() {
|
||||
|
||||
Reference in New Issue
Block a user