From cbca457eff1112988756581a84e331004d6f402a Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Mon, 17 Oct 2022 22:46:06 +0200 Subject: [PATCH] Adapt to HTTP Observation changes in Framework This commit adapts to the renames/package changes in the HTTP Observation support in Spring Framework. See spring-projects/spring-framework#29334 --- .../ClientHttpObservationConventionAdapter.java | 14 +++++++------- .../ClientObservationConventionAdapter.java | 16 ++++++++-------- .../RestTemplateObservationConfiguration.java | 8 ++++---- .../WebClientObservationConfiguration.java | 8 ++++---- ...entHttpObservationConventionAdapterTests.java | 6 +++--- .../ClientObservationConventionAdapterTests.java | 6 +++--- .../DefaultRestTemplateExchangeTagsProvider.java | 3 +-- .../ObservationRestTemplateCustomizer.java | 6 +++--- .../web/client/RestTemplateExchangeTags.java | 4 ++-- .../client/RestTemplateExchangeTagsProvider.java | 4 ++-- .../client/ObservationWebClientCustomizer.java | 6 +++--- .../ObservationRestTemplateCustomizerTests.java | 6 +++--- .../ObservationWebClientCustomizerTests.java | 8 ++++---- 13 files changed, 47 insertions(+), 48 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/client/ClientHttpObservationConventionAdapter.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/client/ClientHttpObservationConventionAdapter.java index 197ec6bc21..31b24e64ee 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/client/ClientHttpObservationConventionAdapter.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/client/ClientHttpObservationConventionAdapter.java @@ -21,17 +21,17 @@ import io.micrometer.core.instrument.Tag; import io.micrometer.observation.Observation; import org.springframework.boot.actuate.metrics.web.client.RestTemplateExchangeTagsProvider; -import org.springframework.http.client.observation.ClientHttpObservationContext; -import org.springframework.http.client.observation.ClientHttpObservationConvention; +import org.springframework.http.client.observation.ClientRequestObservationContext; +import org.springframework.http.client.observation.ClientRequestObservationConvention; /** * Adapter class that applies {@link RestTemplateExchangeTagsProvider} tags as a - * {@link ClientHttpObservationConvention}. + * {@link ClientRequestObservationConvention}. * * @author Brian Clozel */ @SuppressWarnings({ "removal" }) -class ClientHttpObservationConventionAdapter implements ClientHttpObservationConvention { +class ClientHttpObservationConventionAdapter implements ClientRequestObservationConvention { private final String metricName; @@ -44,12 +44,12 @@ class ClientHttpObservationConventionAdapter implements ClientHttpObservationCon @Override public boolean supportsContext(Observation.Context context) { - return context instanceof ClientHttpObservationContext; + return context instanceof ClientRequestObservationContext; } @Override @SuppressWarnings("deprecation") - public KeyValues getLowCardinalityKeyValues(ClientHttpObservationContext context) { + public KeyValues getLowCardinalityKeyValues(ClientRequestObservationContext context) { KeyValues keyValues = KeyValues.empty(); Iterable tags = this.tagsProvider.getTags(context.getUriTemplate(), context.getCarrier(), context.getResponse()); @@ -60,7 +60,7 @@ class ClientHttpObservationConventionAdapter implements ClientHttpObservationCon } @Override - public KeyValues getHighCardinalityKeyValues(ClientHttpObservationContext context) { + public KeyValues getHighCardinalityKeyValues(ClientRequestObservationContext context) { return KeyValues.empty(); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/client/ClientObservationConventionAdapter.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/client/ClientObservationConventionAdapter.java index 130b92c4a6..ef196a9582 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/client/ClientObservationConventionAdapter.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/client/ClientObservationConventionAdapter.java @@ -21,19 +21,19 @@ import io.micrometer.core.instrument.Tag; import io.micrometer.observation.Observation; import org.springframework.boot.actuate.metrics.web.reactive.client.WebClientExchangeTagsProvider; -import org.springframework.web.reactive.function.client.ClientObservationContext; -import org.springframework.web.reactive.function.client.ClientObservationConvention; import org.springframework.web.reactive.function.client.ClientRequest; +import org.springframework.web.reactive.function.client.ClientRequestObservationContext; +import org.springframework.web.reactive.function.client.ClientRequestObservationConvention; import org.springframework.web.reactive.function.client.WebClient; /** * Adapter class that applies {@link WebClientExchangeTagsProvider} tags as a - * {@link ClientObservationConvention}. + * {@link ClientRequestObservationConvention}. * * @author Brian Clozel */ @SuppressWarnings({ "deprecation", "removal" }) -class ClientObservationConventionAdapter implements ClientObservationConvention { +class ClientObservationConventionAdapter implements ClientRequestObservationConvention { private static final String URI_TEMPLATE_ATTRIBUTE = WebClient.class.getName() + ".uriTemplate"; @@ -48,11 +48,11 @@ class ClientObservationConventionAdapter implements ClientObservationConvention @Override public boolean supportsContext(Observation.Context context) { - return context instanceof ClientObservationContext; + return context instanceof ClientRequestObservationContext; } @Override - public KeyValues getLowCardinalityKeyValues(ClientObservationContext context) { + public KeyValues getLowCardinalityKeyValues(ClientRequestObservationContext context) { KeyValues keyValues = KeyValues.empty(); mutateClientRequest(context); Iterable tags = this.tagsProvider.tags(context.getCarrier(), context.getResponse(), context.getError()); @@ -66,14 +66,14 @@ class ClientObservationConventionAdapter implements ClientObservationConvention * {@link WebClientExchangeTagsProvider} relies on a request attribute to get the URI * template, we need to adapt to that. */ - private static void mutateClientRequest(ClientObservationContext context) { + private static void mutateClientRequest(ClientRequestObservationContext context) { ClientRequest clientRequest = ClientRequest.from(context.getCarrier()) .attribute(URI_TEMPLATE_ATTRIBUTE, context.getUriTemplate()).build(); context.setCarrier(clientRequest); } @Override - public KeyValues getHighCardinalityKeyValues(ClientObservationContext context) { + public KeyValues getHighCardinalityKeyValues(ClientRequestObservationContext context) { return KeyValues.empty(); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/client/RestTemplateObservationConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/client/RestTemplateObservationConfiguration.java index a92f23ef21..27f32e1967 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/client/RestTemplateObservationConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/client/RestTemplateObservationConfiguration.java @@ -28,8 +28,8 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.web.client.RestTemplateBuilder; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.http.client.observation.ClientHttpObservationConvention; -import org.springframework.http.client.observation.DefaultClientHttpObservationConvention; +import org.springframework.http.client.observation.ClientRequestObservationConvention; +import org.springframework.http.client.observation.DefaultClientRequestObservationConvention; import org.springframework.web.client.RestTemplate; /** @@ -51,9 +51,9 @@ class RestTemplateObservationConfiguration { String observationName = observationProperties.getHttp().getClient().getRequests().getName(); String name = (observationName != null) ? observationName : metricName; RestTemplateExchangeTagsProvider tagsProvider = optionalTagsProvider.getIfAvailable(); - ClientHttpObservationConvention observationConvention = (tagsProvider != null) + ClientRequestObservationConvention observationConvention = (tagsProvider != null) ? new ClientHttpObservationConventionAdapter(name, tagsProvider) - : new DefaultClientHttpObservationConvention(name); + : new DefaultClientRequestObservationConvention(name); return new ObservationRestTemplateCustomizer(observationRegistry, observationConvention); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/client/WebClientObservationConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/client/WebClientObservationConfiguration.java index 5485e8eac5..967c9a5da9 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/client/WebClientObservationConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/client/WebClientObservationConfiguration.java @@ -26,8 +26,8 @@ import org.springframework.boot.actuate.metrics.web.reactive.client.WebClientExc import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.web.reactive.function.client.ClientObservationConvention; -import org.springframework.web.reactive.function.client.DefaultClientObservationConvention; +import org.springframework.web.reactive.function.client.ClientRequestObservationConvention; +import org.springframework.web.reactive.function.client.DefaultClientRequestObservationConvention; import org.springframework.web.reactive.function.client.WebClient; /** @@ -48,9 +48,9 @@ class WebClientObservationConfiguration { String observationName = observationProperties.getHttp().getClient().getRequests().getName(); String name = (observationName != null) ? observationName : metricName; WebClientExchangeTagsProvider tagsProvider = optionalTagsProvider.getIfAvailable(); - ClientObservationConvention observationConvention = (tagsProvider != null) + ClientRequestObservationConvention observationConvention = (tagsProvider != null) ? new ClientObservationConventionAdapter(name, tagsProvider) - : new DefaultClientObservationConvention(name); + : new DefaultClientRequestObservationConvention(name); return new ObservationWebClientCustomizer(observationRegistry, observationConvention); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/web/client/ClientHttpObservationConventionAdapterTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/web/client/ClientHttpObservationConventionAdapterTests.java index 417ebc2f58..3243e05050 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/web/client/ClientHttpObservationConventionAdapterTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/web/client/ClientHttpObservationConventionAdapterTests.java @@ -28,7 +28,7 @@ import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; import org.springframework.http.client.ClientHttpRequest; import org.springframework.http.client.ClientHttpResponse; -import org.springframework.http.client.observation.ClientHttpObservationContext; +import org.springframework.http.client.observation.ClientRequestObservationContext; import org.springframework.mock.http.client.MockClientHttpRequest; import org.springframework.mock.http.client.MockClientHttpResponse; @@ -51,11 +51,11 @@ class ClientHttpObservationConventionAdapterTests { private ClientHttpResponse response = new MockClientHttpResponse("foo".getBytes(), HttpStatus.OK); - private ClientHttpObservationContext context; + private ClientRequestObservationContext context; @BeforeEach void setup() { - this.context = new ClientHttpObservationContext(this.request); + this.context = new ClientRequestObservationContext(this.request); this.context.setResponse(this.response); this.context.setUriTemplate("/resource/{name}"); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/web/client/ClientObservationConventionAdapterTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/web/client/ClientObservationConventionAdapterTests.java index 1f53cc1842..515ab18a66 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/web/client/ClientObservationConventionAdapterTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/web/client/ClientObservationConventionAdapterTests.java @@ -26,8 +26,8 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.actuate.metrics.web.reactive.client.DefaultWebClientExchangeTagsProvider; import org.springframework.http.HttpMethod; import org.springframework.http.HttpStatus; -import org.springframework.web.reactive.function.client.ClientObservationContext; import org.springframework.web.reactive.function.client.ClientRequest; +import org.springframework.web.reactive.function.client.ClientRequestObservationContext; import org.springframework.web.reactive.function.client.ClientResponse; import static org.assertj.core.api.Assertions.assertThat; @@ -49,11 +49,11 @@ class ClientObservationConventionAdapterTests { private ClientResponse response = ClientResponse.create(HttpStatus.OK).body("foo").build(); - private ClientObservationContext context; + private ClientRequestObservationContext context; @BeforeEach void setup() { - this.context = new ClientObservationContext(); + this.context = new ClientRequestObservationContext(); this.context.setCarrier(this.request); this.context.setResponse(this.response); this.context.setUriTemplate("/resource/{name}"); diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/DefaultRestTemplateExchangeTagsProvider.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/DefaultRestTemplateExchangeTagsProvider.java index 2e607614eb..18f9965318 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/DefaultRestTemplateExchangeTagsProvider.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/DefaultRestTemplateExchangeTagsProvider.java @@ -22,7 +22,6 @@ import io.micrometer.core.instrument.Tag; import org.springframework.http.HttpRequest; import org.springframework.http.client.ClientHttpResponse; -import org.springframework.http.client.observation.DefaultClientHttpObservationConvention; import org.springframework.util.StringUtils; /** @@ -32,7 +31,7 @@ import org.springframework.util.StringUtils; * @author Nishant Raut * @since 2.0.0 * @deprecated since 3.0.0 for removal in 3.2.0 in favor of - * {@link DefaultClientHttpObservationConvention} + * {@link org.springframework.http.client.observation.DefaultClientRequestObservationConvention} */ @Deprecated(since = "3.0.0", forRemoval = true) @SuppressWarnings({ "deprecation", "removal" }) diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/ObservationRestTemplateCustomizer.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/ObservationRestTemplateCustomizer.java index 3a407475a6..8bcb7ff29d 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/ObservationRestTemplateCustomizer.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/ObservationRestTemplateCustomizer.java @@ -19,7 +19,7 @@ package org.springframework.boot.actuate.metrics.web.client; import io.micrometer.observation.ObservationRegistry; import org.springframework.boot.web.client.RestTemplateCustomizer; -import org.springframework.http.client.observation.ClientHttpObservationConvention; +import org.springframework.http.client.observation.ClientRequestObservationConvention; import org.springframework.web.client.RestTemplate; /** @@ -33,7 +33,7 @@ public class ObservationRestTemplateCustomizer implements RestTemplateCustomizer private final ObservationRegistry observationRegistry; - private final ClientHttpObservationConvention observationConvention; + private final ClientRequestObservationConvention observationConvention; /** * Create a new {@code ObservationRestTemplateCustomizer}. @@ -41,7 +41,7 @@ public class ObservationRestTemplateCustomizer implements RestTemplateCustomizer * @param observationRegistry the observation registry */ public ObservationRestTemplateCustomizer(ObservationRegistry observationRegistry, - ClientHttpObservationConvention observationConvention) { + ClientRequestObservationConvention observationConvention) { this.observationConvention = observationConvention; this.observationRegistry = observationRegistry; } diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/RestTemplateExchangeTags.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/RestTemplateExchangeTags.java index 2bf32cb3c7..5f17ee3d4f 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/RestTemplateExchangeTags.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/RestTemplateExchangeTags.java @@ -25,7 +25,7 @@ import io.micrometer.core.instrument.Tag; import org.springframework.boot.actuate.metrics.http.Outcome; import org.springframework.http.HttpRequest; import org.springframework.http.client.ClientHttpResponse; -import org.springframework.http.client.observation.DefaultClientHttpObservationConvention; +import org.springframework.http.client.observation.DefaultClientRequestObservationConvention; import org.springframework.util.StringUtils; import org.springframework.web.client.RestTemplate; @@ -39,7 +39,7 @@ import org.springframework.web.client.RestTemplate; * @author Brian Clozel * @since 2.0.0 * @deprecated since 3.0.0 for removal in 3.2.0 in favor of - * {@link DefaultClientHttpObservationConvention} + * {@link DefaultClientRequestObservationConvention} */ @Deprecated(since = "3.0.0", forRemoval = true) public final class RestTemplateExchangeTags { diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/RestTemplateExchangeTagsProvider.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/RestTemplateExchangeTagsProvider.java index 04bd7cdf70..ea3c05360c 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/RestTemplateExchangeTagsProvider.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/client/RestTemplateExchangeTagsProvider.java @@ -20,7 +20,7 @@ import io.micrometer.core.instrument.Tag; import org.springframework.http.HttpRequest; import org.springframework.http.client.ClientHttpResponse; -import org.springframework.http.client.observation.ClientHttpObservationConvention; +import org.springframework.http.client.observation.ClientRequestObservationConvention; import org.springframework.web.client.RestTemplate; /** @@ -30,7 +30,7 @@ import org.springframework.web.client.RestTemplate; * @author Andy Wilkinson * @since 2.0.0 * @deprecated since 3.0.0 for removal in 3.2.0 in favor of - * {@link ClientHttpObservationConvention} + * {@link ClientRequestObservationConvention} */ @FunctionalInterface @Deprecated(since = "3.0.0", forRemoval = true) diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/client/ObservationWebClientCustomizer.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/client/ObservationWebClientCustomizer.java index af85ad0839..49f2601b94 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/client/ObservationWebClientCustomizer.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/client/ObservationWebClientCustomizer.java @@ -19,7 +19,7 @@ package org.springframework.boot.actuate.metrics.web.reactive.client; import io.micrometer.observation.ObservationRegistry; import org.springframework.boot.web.reactive.function.client.WebClientCustomizer; -import org.springframework.web.reactive.function.client.ClientObservationConvention; +import org.springframework.web.reactive.function.client.ClientRequestObservationConvention; import org.springframework.web.reactive.function.client.WebClient; /** @@ -33,7 +33,7 @@ public class ObservationWebClientCustomizer implements WebClientCustomizer { private final ObservationRegistry observationRegistry; - private final ClientObservationConvention observationConvention; + private final ClientRequestObservationConvention observationConvention; /** * Create a new {@code ObservationWebClientCustomizer} that will configure the @@ -42,7 +42,7 @@ public class ObservationWebClientCustomizer implements WebClientCustomizer { * @param observationConvention the convention to use to populate observations */ public ObservationWebClientCustomizer(ObservationRegistry observationRegistry, - ClientObservationConvention observationConvention) { + ClientRequestObservationConvention observationConvention) { this.observationRegistry = observationRegistry; this.observationConvention = observationConvention; } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/client/ObservationRestTemplateCustomizerTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/client/ObservationRestTemplateCustomizerTests.java index 815ffc4d82..6d7a65d8ce 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/client/ObservationRestTemplateCustomizerTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/client/ObservationRestTemplateCustomizerTests.java @@ -20,7 +20,7 @@ import io.micrometer.observation.ObservationRegistry; import io.micrometer.observation.tck.TestObservationRegistry; import org.junit.jupiter.api.Test; -import org.springframework.http.client.observation.DefaultClientHttpObservationConvention; +import org.springframework.http.client.observation.DefaultClientRequestObservationConvention; import org.springframework.web.client.RestTemplate; import static org.assertj.core.api.Assertions.assertThat; @@ -39,14 +39,14 @@ class ObservationRestTemplateCustomizerTests { private RestTemplate restTemplate = new RestTemplate(); private ObservationRestTemplateCustomizer customizer = new ObservationRestTemplateCustomizer( - this.observationRegistry, new DefaultClientHttpObservationConvention(TEST_METRIC_NAME)); + this.observationRegistry, new DefaultClientRequestObservationConvention(TEST_METRIC_NAME)); @Test void shouldCustomizeObservationConfiguration() { this.customizer.customize(this.restTemplate); assertThat(this.restTemplate).hasFieldOrPropertyWithValue("observationRegistry", this.observationRegistry); assertThat(this.restTemplate).extracting("observationConvention") - .isInstanceOf(DefaultClientHttpObservationConvention.class) + .isInstanceOf(DefaultClientRequestObservationConvention.class) .hasFieldOrPropertyWithValue("name", TEST_METRIC_NAME); } diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/client/ObservationWebClientCustomizerTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/client/ObservationWebClientCustomizerTests.java index 85ec0ae59a..3aa6f01dbc 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/client/ObservationWebClientCustomizerTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/web/reactive/client/ObservationWebClientCustomizerTests.java @@ -19,8 +19,8 @@ package org.springframework.boot.actuate.metrics.web.reactive.client; import io.micrometer.observation.tck.TestObservationRegistry; import org.junit.jupiter.api.Test; -import org.springframework.web.reactive.function.client.ClientObservationConvention; -import org.springframework.web.reactive.function.client.DefaultClientObservationConvention; +import org.springframework.web.reactive.function.client.ClientRequestObservationConvention; +import org.springframework.web.reactive.function.client.DefaultClientRequestObservationConvention; import org.springframework.web.reactive.function.client.WebClient; import static org.assertj.core.api.Assertions.assertThat; @@ -37,7 +37,7 @@ class ObservationWebClientCustomizerTests { private TestObservationRegistry observationRegistry = TestObservationRegistry.create(); - private ClientObservationConvention observationConvention = new DefaultClientObservationConvention( + private ClientRequestObservationConvention observationConvention = new DefaultClientRequestObservationConvention( TEST_METRIC_NAME); private ObservationWebClientCustomizer customizer = new ObservationWebClientCustomizer(this.observationRegistry, @@ -50,7 +50,7 @@ class ObservationWebClientCustomizerTests { this.customizer.customize(this.clientBuilder); assertThat(this.clientBuilder).hasFieldOrPropertyWithValue("observationRegistry", this.observationRegistry); assertThat(this.clientBuilder).extracting("observationConvention") - .isInstanceOf(DefaultClientObservationConvention.class) + .isInstanceOf(DefaultClientRequestObservationConvention.class) .hasFieldOrPropertyWithValue("name", TEST_METRIC_NAME); }