diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/ObservationAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/ObservationAutoConfiguration.java index 1b0f9c4205..c0114bf211 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/ObservationAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/ObservationAutoConfiguration.java @@ -17,7 +17,7 @@ package org.springframework.boot.actuate.autoconfigure.observation; import io.micrometer.core.instrument.MeterRegistry; -import io.micrometer.observation.Observation.GlobalTagsProvider; +import io.micrometer.observation.Observation.GlobalKeyValuesProvider; import io.micrometer.observation.ObservationHandler; import io.micrometer.observation.ObservationPredicate; import io.micrometer.observation.ObservationRegistry; @@ -48,7 +48,7 @@ public class ObservationAutoConfiguration { static ObservationRegistryPostProcessor observationRegistryPostProcessor( ObjectProvider> observationRegistryCustomizers, ObjectProvider observationPredicates, - ObjectProvider> tagProviders, + ObjectProvider> tagProviders, ObjectProvider> observationHandlers, ObjectProvider observationHandlerGrouping) { return new ObservationRegistryPostProcessor(observationRegistryCustomizers, observationPredicates, tagProviders, diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/ObservationRegistryConfigurer.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/ObservationRegistryConfigurer.java index e4f0c88d35..83cb91eb83 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/ObservationRegistryConfigurer.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/ObservationRegistryConfigurer.java @@ -18,7 +18,7 @@ package org.springframework.boot.actuate.autoconfigure.observation; import java.util.List; -import io.micrometer.observation.Observation.GlobalTagsProvider; +import io.micrometer.observation.Observation.GlobalKeyValuesProvider; import io.micrometer.observation.ObservationHandler; import io.micrometer.observation.ObservationPredicate; import io.micrometer.observation.ObservationRegistry; @@ -29,7 +29,7 @@ import org.springframework.boot.util.LambdaSafe; /** * Configurer to apply {@link ObservationRegistryCustomizer customizers} to * {@link ObservationRegistry observation registries}. Installs - * {@link ObservationPredicate observation predicates} and {@link GlobalTagsProvider + * {@link ObservationPredicate observation predicates} and {@link GlobalKeyValuesProvider * global tag providers} into the {@link ObservationRegistry}. Also uses a * {@link ObservationHandlerGrouping} to group handlers, which are then added to the * {@link ObservationRegistry}. @@ -42,7 +42,7 @@ class ObservationRegistryConfigurer { private final ObjectProvider observationPredicates; - private final ObjectProvider> tagProviders; + private final ObjectProvider> tagProviders; private final ObjectProvider> observationHandlers; @@ -50,7 +50,7 @@ class ObservationRegistryConfigurer { ObservationRegistryConfigurer(ObjectProvider> customizers, ObjectProvider observationPredicates, - ObjectProvider> tagProviders, + ObjectProvider> tagProviders, ObjectProvider> observationHandlers, ObjectProvider observationHandlerGrouping) { this.customizers = customizers; @@ -79,7 +79,7 @@ class ObservationRegistryConfigurer { private void registerGlobalTagsProvider(ObservationRegistry registry) { this.tagProviders.orderedStream() - .forEach((tagProvider) -> registry.observationConfig().tagsProvider(tagProvider)); + .forEach((tagProvider) -> registry.observationConfig().keyValuesProvider(tagProvider)); } @SuppressWarnings("unchecked") diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/ObservationRegistryPostProcessor.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/ObservationRegistryPostProcessor.java index c3404c1fd8..baa1ca0d33 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/ObservationRegistryPostProcessor.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/observation/ObservationRegistryPostProcessor.java @@ -16,7 +16,7 @@ package org.springframework.boot.actuate.autoconfigure.observation; -import io.micrometer.observation.Observation.GlobalTagsProvider; +import io.micrometer.observation.Observation.GlobalKeyValuesProvider; import io.micrometer.observation.ObservationHandler; import io.micrometer.observation.ObservationPredicate; import io.micrometer.observation.ObservationRegistry; @@ -38,7 +38,7 @@ class ObservationRegistryPostProcessor implements BeanPostProcessor { private final ObjectProvider observationPredicates; - private final ObjectProvider> tagProviders; + private final ObjectProvider> tagProviders; private final ObjectProvider> observationHandlers; @@ -48,7 +48,7 @@ class ObservationRegistryPostProcessor implements BeanPostProcessor { ObservationRegistryPostProcessor(ObjectProvider> observationRegistryCustomizers, ObjectProvider observationPredicates, - ObjectProvider> tagProviders, + ObjectProvider> tagProviders, ObjectProvider> observationHandlers, ObjectProvider observationHandlerGrouping) { this.observationRegistryCustomizers = observationRegistryCustomizers; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/ObservationAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/ObservationAutoConfigurationTests.java index fdd38c9796..4f3a2273e0 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/ObservationAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/observation/ObservationAutoConfigurationTests.java @@ -19,14 +19,15 @@ package org.springframework.boot.actuate.autoconfigure.observation; import java.util.ArrayList; import java.util.List; -import io.micrometer.common.Tag; -import io.micrometer.common.Tags; +import io.micrometer.common.KeyValue; +import io.micrometer.common.KeyValues; import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.Tags; import io.micrometer.core.instrument.observation.MeterObservationHandler; import io.micrometer.core.instrument.search.MeterNotFoundException; import io.micrometer.observation.Observation; import io.micrometer.observation.Observation.Context; -import io.micrometer.observation.Observation.GlobalTagsProvider; +import io.micrometer.observation.Observation.GlobalKeyValuesProvider; import io.micrometer.observation.ObservationHandler; import io.micrometer.observation.ObservationHandler.AllMatchingCompositeObservationHandler; import io.micrometer.observation.ObservationHandler.FirstMatchingCompositeObservationHandler; @@ -104,7 +105,7 @@ class ObservationAutoConfigurationTests { ObservationRegistry observationRegistry = context.getBean(ObservationRegistry.class); Context micrometerContext = new Context(); Observation.start("test-observation", micrometerContext, observationRegistry).stop(); - assertThat(micrometerContext.getAllTags()).containsExactly(Tag.of("tag1", "value1")); + assertThat(micrometerContext.getAllKeyValues()).containsExactly(KeyValue.of("tag1", "value1")); }); } @@ -164,16 +165,16 @@ class ObservationAutoConfigurationTests { static class GlobalTagsProviders { @Bean - GlobalTagsProvider customTagsProvider() { - return new GlobalTagsProvider<>() { + Observation.GlobalKeyValuesProvider customTagsProvider() { + return new GlobalKeyValuesProvider<>() { @Override public boolean supportsContext(Context context) { return true; } @Override - public Tags getLowCardinalityTags(Context context) { - return Tags.of("tag1", "value1"); + public KeyValues getLowCardinalityKeyValues(Context context) { + return KeyValues.of("tag1", "value1"); } }; } diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index 6f3491e642..b8d15a03ce 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -976,7 +976,7 @@ bom { ] } } - library("Micrometer", "2.0.0-SNAPSHOT") { + library("Micrometer", "1.10.0-SNAPSHOT") { group("io.micrometer") { modules = [ "micrometer-registry-stackdriver" {