diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle b/spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle index 395a71c8a5..e7d4d6ea8c 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle @@ -48,7 +48,6 @@ dependencies { optional("io.dropwizard.metrics:metrics-jmx") optional("io.lettuce:lettuce-core") optional("io.micrometer:micrometer-core") - optional("io.micrometer:micrometer-binders") optional("io.micrometer:micrometer-registry-appoptics") optional("io.micrometer:micrometer-registry-atlas") { exclude group: "javax.inject", module: "javax.inject" diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/JvmMetricsAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/JvmMetricsAutoConfiguration.java index 6f500ebb28..929b7024bf 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/JvmMetricsAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/JvmMetricsAutoConfiguration.java @@ -16,12 +16,12 @@ package org.springframework.boot.actuate.autoconfigure.metrics; -import io.micrometer.binder.jvm.ClassLoaderMetrics; -import io.micrometer.binder.jvm.JvmGcMetrics; -import io.micrometer.binder.jvm.JvmHeapPressureMetrics; -import io.micrometer.binder.jvm.JvmMemoryMetrics; -import io.micrometer.binder.jvm.JvmThreadMetrics; import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.binder.jvm.ClassLoaderMetrics; +import io.micrometer.core.instrument.binder.jvm.JvmGcMetrics; +import io.micrometer.core.instrument.binder.jvm.JvmHeapPressureMetrics; +import io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics; +import io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; @@ -39,39 +39,34 @@ import org.springframework.context.annotation.Bean; @AutoConfiguration(after = { MetricsAutoConfiguration.class, CompositeMeterRegistryAutoConfiguration.class }) @ConditionalOnClass(MeterRegistry.class) @ConditionalOnBean(MeterRegistry.class) -@SuppressWarnings("deprecation") public class JvmMetricsAutoConfiguration { @Bean - @ConditionalOnMissingBean({ JvmGcMetrics.class, io.micrometer.core.instrument.binder.jvm.JvmGcMetrics.class }) + @ConditionalOnMissingBean public JvmGcMetrics jvmGcMetrics() { return new JvmGcMetrics(); } @Bean - @ConditionalOnMissingBean({ JvmHeapPressureMetrics.class, - io.micrometer.core.instrument.binder.jvm.JvmHeapPressureMetrics.class }) + @ConditionalOnMissingBean public JvmHeapPressureMetrics jvmHeapPressureMetrics() { return new JvmHeapPressureMetrics(); } @Bean - @ConditionalOnMissingBean({ JvmMemoryMetrics.class, - io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics.class }) + @ConditionalOnMissingBean public JvmMemoryMetrics jvmMemoryMetrics() { return new JvmMemoryMetrics(); } @Bean - @ConditionalOnMissingBean({ JvmThreadMetrics.class, - io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics.class }) + @ConditionalOnMissingBean public JvmThreadMetrics jvmThreadMetrics() { return new JvmThreadMetrics(); } @Bean - @ConditionalOnMissingBean({ ClassLoaderMetrics.class, - io.micrometer.core.instrument.binder.jvm.ClassLoaderMetrics.class }) + @ConditionalOnMissingBean public ClassLoaderMetrics classLoaderMetrics() { return new ClassLoaderMetrics(); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/KafkaMetricsAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/KafkaMetricsAutoConfiguration.java index 31842b7e58..fc5c39ca77 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/KafkaMetricsAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/KafkaMetricsAutoConfiguration.java @@ -16,9 +16,9 @@ package org.springframework.boot.actuate.autoconfigure.metrics; -import io.micrometer.binder.kafka.KafkaClientMetrics; -import io.micrometer.binder.kafka.KafkaStreamsMetrics; import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.binder.kafka.KafkaClientMetrics; +import io.micrometer.core.instrument.binder.kafka.KafkaStreamsMetrics; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/Log4J2MetricsAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/Log4J2MetricsAutoConfiguration.java index 44da20d0c0..d2039e0466 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/Log4J2MetricsAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/Log4J2MetricsAutoConfiguration.java @@ -16,8 +16,8 @@ package org.springframework.boot.actuate.autoconfigure.metrics; -import io.micrometer.binder.logging.Log4j2Metrics; import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.binder.logging.Log4j2Metrics; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.spi.LoggerContext; @@ -44,11 +44,10 @@ import org.springframework.core.type.AnnotatedTypeMetadata; name = "org.apache.logging.log4j.core.LoggerContext") @ConditionalOnBean(MeterRegistry.class) @Conditional(Log4JCoreLoggerContextCondition.class) -@SuppressWarnings("deprecation") public class Log4J2MetricsAutoConfiguration { @Bean - @ConditionalOnMissingBean({ Log4j2Metrics.class, io.micrometer.core.instrument.binder.logging.Log4j2Metrics.class }) + @ConditionalOnMissingBean public Log4j2Metrics log4j2Metrics() { return new Log4j2Metrics(); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/LogbackMetricsAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/LogbackMetricsAutoConfiguration.java index a3169f36ad..8a76340ff2 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/LogbackMetricsAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/LogbackMetricsAutoConfiguration.java @@ -17,8 +17,8 @@ package org.springframework.boot.actuate.autoconfigure.metrics; import ch.qos.logback.classic.LoggerContext; -import io.micrometer.binder.logging.LogbackMetrics; import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.binder.logging.LogbackMetrics; import org.slf4j.ILoggerFactory; import org.slf4j.LoggerFactory; @@ -46,12 +46,10 @@ import org.springframework.core.type.AnnotatedTypeMetadata; @ConditionalOnClass({ MeterRegistry.class, LoggerContext.class, LoggerFactory.class }) @ConditionalOnBean(MeterRegistry.class) @Conditional(LogbackLoggingCondition.class) -@SuppressWarnings("deprecation") public class LogbackMetricsAutoConfiguration { @Bean - @ConditionalOnMissingBean({ LogbackMetrics.class, - io.micrometer.core.instrument.binder.logging.LogbackMetrics.class }) + @ConditionalOnMissingBean public LogbackMetrics logbackMetrics() { return new LogbackMetrics(); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/SystemMetricsAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/SystemMetricsAutoConfiguration.java index d186e20f29..30111b97e8 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/SystemMetricsAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/SystemMetricsAutoConfiguration.java @@ -19,11 +19,11 @@ package org.springframework.boot.actuate.autoconfigure.metrics; import java.io.File; import java.util.List; -import io.micrometer.binder.system.FileDescriptorMetrics; -import io.micrometer.binder.system.ProcessorMetrics; -import io.micrometer.binder.system.UptimeMetrics; import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.Tags; +import io.micrometer.core.instrument.binder.system.FileDescriptorMetrics; +import io.micrometer.core.instrument.binder.system.ProcessorMetrics; +import io.micrometer.core.instrument.binder.system.UptimeMetrics; import org.springframework.boot.actuate.metrics.system.DiskSpaceMetricsBinder; import org.springframework.boot.autoconfigure.AutoConfiguration; @@ -45,25 +45,22 @@ import org.springframework.context.annotation.Bean; @ConditionalOnClass(MeterRegistry.class) @ConditionalOnBean(MeterRegistry.class) @EnableConfigurationProperties(MetricsProperties.class) -@SuppressWarnings("deprecation") public class SystemMetricsAutoConfiguration { @Bean - @ConditionalOnMissingBean({ UptimeMetrics.class, io.micrometer.core.instrument.binder.system.UptimeMetrics.class }) + @ConditionalOnMissingBean public UptimeMetrics uptimeMetrics() { return new UptimeMetrics(); } @Bean - @ConditionalOnMissingBean({ ProcessorMetrics.class, - io.micrometer.core.instrument.binder.system.ProcessorMetrics.class }) + @ConditionalOnMissingBean public ProcessorMetrics processorMetrics() { return new ProcessorMetrics(); } @Bean - @ConditionalOnMissingBean({ FileDescriptorMetrics.class, - io.micrometer.core.instrument.binder.system.FileDescriptorMetrics.class }) + @ConditionalOnMissingBean public FileDescriptorMetrics fileDescriptorMetrics() { return new FileDescriptorMetrics(); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/jersey/JerseyConfigurations.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/jersey/JerseyConfigurations.java deleted file mode 100644 index 6b962d1440..0000000000 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/jersey/JerseyConfigurations.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2012-2022 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.actuate.autoconfigure.metrics.jersey; - -import io.micrometer.binder.jersey.server.DefaultJerseyTagsProvider; -import io.micrometer.binder.jersey.server.JerseyTagsProvider; - -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.context.annotation.Bean; - -/** - * Configurations, imported from {@link JerseyServerMetricsAutoConfiguration}. - * - * @author Moritz Halbritter - */ -@SuppressWarnings("deprecation") -abstract class JerseyConfigurations { - - static class JerseyTagsProviderConfiguration { - - @Bean - @ConditionalOnMissingBean({ JerseyTagsProvider.class, - io.micrometer.core.instrument.binder.jersey.server.JerseyTagsProvider.class }) - DefaultJerseyTagsProvider jerseyTagsProvider() { - return new DefaultJerseyTagsProvider(); - } - - } - -} diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/jersey/JerseyServerMetricsAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/jersey/JerseyServerMetricsAutoConfiguration.java index cd60871d0d..382d71daf9 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/jersey/JerseyServerMetricsAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/jersey/JerseyServerMetricsAutoConfiguration.java @@ -19,10 +19,11 @@ package org.springframework.boot.actuate.autoconfigure.metrics.jersey; import java.lang.annotation.Annotation; import java.lang.reflect.AnnotatedElement; -import io.micrometer.binder.jersey.server.AnnotationFinder; -import io.micrometer.binder.jersey.server.JerseyTagsProvider; -import io.micrometer.binder.jersey.server.MetricsApplicationEventListener; import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.binder.jersey.server.AnnotationFinder; +import io.micrometer.core.instrument.binder.jersey.server.DefaultJerseyTagsProvider; +import io.micrometer.core.instrument.binder.jersey.server.JerseyTagsProvider; +import io.micrometer.core.instrument.binder.jersey.server.MetricsApplicationEventListener; import io.micrometer.core.instrument.config.MeterFilter; import org.glassfish.jersey.server.ResourceConfig; @@ -31,16 +32,15 @@ import org.springframework.boot.actuate.autoconfigure.metrics.MetricsProperties; import org.springframework.boot.actuate.autoconfigure.metrics.MetricsProperties.Web.Server; import org.springframework.boot.actuate.autoconfigure.metrics.OnlyOnceLoggingDenyMeterFilter; import org.springframework.boot.actuate.autoconfigure.metrics.export.simple.SimpleMetricsExportAutoConfiguration; -import org.springframework.boot.actuate.autoconfigure.metrics.jersey.JerseyConfigurations.JerseyTagsProviderConfiguration; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.boot.autoconfigure.jersey.ResourceConfigCustomizer; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Import; import org.springframework.core.annotation.AnnotationUtils; import org.springframework.core.annotation.Order; @@ -57,8 +57,6 @@ import org.springframework.core.annotation.Order; @ConditionalOnClass({ ResourceConfig.class, MetricsApplicationEventListener.class }) @ConditionalOnBean({ MeterRegistry.class, ResourceConfig.class }) @EnableConfigurationProperties(MetricsProperties.class) -@Import(JerseyTagsProviderConfiguration.class) -@SuppressWarnings("deprecation") public class JerseyServerMetricsAutoConfiguration { private final MetricsProperties properties; @@ -68,7 +66,12 @@ public class JerseyServerMetricsAutoConfiguration { } @Bean - @ConditionalOnBean(JerseyTagsProvider.class) + @ConditionalOnMissingBean(JerseyTagsProvider.class) + public DefaultJerseyTagsProvider jerseyTagsProvider() { + return new DefaultJerseyTagsProvider(); + } + + @Bean public ResourceConfigCustomizer jerseyServerMetricsResourceConfigCustomizer(MeterRegistry meterRegistry, JerseyTagsProvider tagsProvider) { Server server = this.properties.getWeb().getServer(); @@ -77,19 +80,6 @@ public class JerseyServerMetricsAutoConfiguration { server.getRequest().getAutotime().isEnabled(), new AnnotationUtilsAnnotationFinder())); } - @Bean - @ConditionalOnBean(io.micrometer.core.instrument.binder.jersey.server.JerseyTagsProvider.class) - public ResourceConfigCustomizer jerseyServerMetricsResourceConfigCustomizerBackwardsCompatible( - MeterRegistry meterRegistry, - io.micrometer.core.instrument.binder.jersey.server.JerseyTagsProvider tagsProvider) { - Server server = this.properties.getWeb().getServer(); - return (config) -> config.register( - new io.micrometer.core.instrument.binder.jersey.server.MetricsApplicationEventListener(meterRegistry, - tagsProvider, server.getRequest().getMetricName(), - server.getRequest().getAutotime().isEnabled(), - new AnnotationUtilsAnnotationFinderBackwardsCompatible())); - } - @Bean @Order(0) public MeterFilter jerseyMetricsUriTagFilter() { @@ -112,18 +102,4 @@ public class JerseyServerMetricsAutoConfiguration { } - /** - * An {@link AnnotationFinder} (for backwards compatability) that uses - * {@link AnnotationUtils}. - */ - private static class AnnotationUtilsAnnotationFinderBackwardsCompatible - implements io.micrometer.core.instrument.binder.jersey.server.AnnotationFinder { - - @Override - public A findAnnotation(AnnotatedElement annotatedElement, Class annotationType) { - return AnnotationUtils.findAnnotation(annotatedElement, annotationType); - } - - } - } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/mongo/MongoConfigurations.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/mongo/MongoConfigurations.java deleted file mode 100644 index 19be26227e..0000000000 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/mongo/MongoConfigurations.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright 2012-2022 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.boot.actuate.autoconfigure.metrics.mongo; - -import io.micrometer.binder.mongodb.DefaultMongoCommandTagsProvider; -import io.micrometer.binder.mongodb.DefaultMongoConnectionPoolTagsProvider; -import io.micrometer.binder.mongodb.MongoCommandTagsProvider; -import io.micrometer.binder.mongodb.MongoMetricsCommandListener; -import io.micrometer.core.instrument.MeterRegistry; - -import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; - -/** - * Configurations, imported from {@link MongoMetricsAutoConfiguration}. - * - * @author Moritz Halbritter - */ -@SuppressWarnings("deprecation") -abstract class MongoConfigurations { - - @Configuration(proxyBeanMethods = false) - static class MongoCommandTagsProviderConfiguration { - - @Bean - @ConditionalOnMissingBean({ MongoCommandTagsProvider.class, - io.micrometer.core.instrument.binder.mongodb.MongoCommandTagsProvider.class }) - MongoCommandTagsProvider mongoCommandTagsProvider() { - return new DefaultMongoCommandTagsProvider(); - } - - } - - @Configuration(proxyBeanMethods = false) - @Import(MongoCommandTagsProviderConfiguration.class) - static class MongoMetricsCommandListenerConfiguration { - - @Bean - @ConditionalOnMissingBean({ MongoMetricsCommandListener.class, - io.micrometer.core.instrument.binder.mongodb.MongoMetricsCommandListener.class }) - @ConditionalOnBean(MongoCommandTagsProvider.class) - MongoMetricsCommandListener mongoMetricsCommandListener(MeterRegistry meterRegistry, - MongoCommandTagsProvider mongoCommandTagsProvider) { - return new MongoMetricsCommandListener(meterRegistry, mongoCommandTagsProvider); - } - - @Bean - @ConditionalOnMissingBean({ MongoMetricsCommandListener.class, - io.micrometer.core.instrument.binder.mongodb.MongoMetricsCommandListener.class }) - @ConditionalOnBean(io.micrometer.core.instrument.binder.mongodb.MongoCommandTagsProvider.class) - io.micrometer.core.instrument.binder.mongodb.MongoMetricsCommandListener mongoMetricsCommandListenerBackwardsCompatible( - MeterRegistry meterRegistry, - io.micrometer.core.instrument.binder.mongodb.MongoCommandTagsProvider mongoCommandTagsProvider) { - return new io.micrometer.core.instrument.binder.mongodb.MongoMetricsCommandListener(meterRegistry, - mongoCommandTagsProvider); - } - - } - - @Configuration(proxyBeanMethods = false) - static class MongoConnectionPoolTagsProviderConfiguration { - - @Bean - @ConditionalOnMissingBean({ io.micrometer.binder.mongodb.MongoConnectionPoolTagsProvider.class, - io.micrometer.core.instrument.binder.mongodb.MongoConnectionPoolTagsProvider.class }) - io.micrometer.binder.mongodb.MongoConnectionPoolTagsProvider mongoConnectionPoolTagsProvider() { - return new DefaultMongoConnectionPoolTagsProvider(); - } - - } - - @Configuration(proxyBeanMethods = false) - @Import(MongoConnectionPoolTagsProviderConfiguration.class) - static class MongoMetricsConnectionPoolListenerConfiguration { - - @Bean - @ConditionalOnMissingBean({ io.micrometer.binder.mongodb.MongoMetricsConnectionPoolListener.class, - io.micrometer.core.instrument.binder.mongodb.MongoMetricsConnectionPoolListener.class }) - @ConditionalOnBean(io.micrometer.binder.mongodb.MongoConnectionPoolTagsProvider.class) - io.micrometer.binder.mongodb.MongoMetricsConnectionPoolListener mongoMetricsConnectionPoolListener( - MeterRegistry meterRegistry, - io.micrometer.binder.mongodb.MongoConnectionPoolTagsProvider mongoConnectionPoolTagsProvider) { - return new io.micrometer.binder.mongodb.MongoMetricsConnectionPoolListener(meterRegistry, - mongoConnectionPoolTagsProvider); - } - - @Bean - @ConditionalOnMissingBean({ io.micrometer.binder.mongodb.MongoMetricsConnectionPoolListener.class, - io.micrometer.core.instrument.binder.mongodb.MongoMetricsConnectionPoolListener.class }) - @ConditionalOnBean(io.micrometer.core.instrument.binder.mongodb.MongoConnectionPoolTagsProvider.class) - io.micrometer.core.instrument.binder.mongodb.MongoMetricsConnectionPoolListener mongoMetricsConnectionPoolListenerBackwardsCompatible( - MeterRegistry meterRegistry, - io.micrometer.core.instrument.binder.mongodb.MongoConnectionPoolTagsProvider mongoConnectionPoolTagsProvider) { - return new io.micrometer.core.instrument.binder.mongodb.MongoMetricsConnectionPoolListener(meterRegistry, - mongoConnectionPoolTagsProvider); - } - - } - -} diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/mongo/MongoMetricsAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/mongo/MongoMetricsAutoConfiguration.java index 250775a9e1..1e448b46f0 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/mongo/MongoMetricsAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/mongo/MongoMetricsAutoConfiguration.java @@ -17,83 +17,86 @@ package org.springframework.boot.actuate.autoconfigure.metrics.mongo; import com.mongodb.MongoClientSettings; -import io.micrometer.binder.mongodb.MongoMetricsCommandListener; -import io.micrometer.binder.mongodb.MongoMetricsConnectionPoolListener; import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.binder.mongodb.DefaultMongoCommandTagsProvider; +import io.micrometer.core.instrument.binder.mongodb.DefaultMongoConnectionPoolTagsProvider; +import io.micrometer.core.instrument.binder.mongodb.MongoCommandTagsProvider; +import io.micrometer.core.instrument.binder.mongodb.MongoConnectionPoolTagsProvider; +import io.micrometer.core.instrument.binder.mongodb.MongoMetricsCommandListener; +import io.micrometer.core.instrument.binder.mongodb.MongoMetricsConnectionPoolListener; import org.springframework.boot.actuate.autoconfigure.metrics.CompositeMeterRegistryAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration; -import org.springframework.boot.actuate.autoconfigure.metrics.mongo.MongoConfigurations.MongoMetricsCommandListenerConfiguration; -import org.springframework.boot.actuate.autoconfigure.metrics.mongo.MongoConfigurations.MongoMetricsConnectionPoolListenerConfiguration; import org.springframework.boot.autoconfigure.AutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration; import org.springframework.boot.autoconfigure.mongo.MongoClientSettingsBuilderCustomizer; import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; /** * {@link EnableAutoConfiguration Auto-configuration} for Mongo metrics. * * @author Chris Bono * @author Jonatan Ivanov - * @author Moritz Halbritter * @since 2.5.0 */ @AutoConfiguration(before = MongoAutoConfiguration.class, after = { MetricsAutoConfiguration.class, CompositeMeterRegistryAutoConfiguration.class }) @ConditionalOnClass(MongoClientSettings.class) @ConditionalOnBean(MeterRegistry.class) -@SuppressWarnings("deprecation") public class MongoMetricsAutoConfiguration { - @Configuration(proxyBeanMethods = false) @ConditionalOnClass(MongoMetricsCommandListener.class) @ConditionalOnProperty(name = "management.metrics.mongo.command.enabled", havingValue = "true", matchIfMissing = true) - @Import(MongoMetricsCommandListenerConfiguration.class) static class MongoCommandMetricsConfiguration { @Bean - @ConditionalOnBean(MongoMetricsCommandListener.class) - MongoClientSettingsBuilderCustomizer mongoMetricsCommandListenerClientSettingsBuilderCustomizer( - MongoMetricsCommandListener mongoMetricsCommandListener) { - return (clientSettingsBuilder) -> clientSettingsBuilder.addCommandListener(mongoMetricsCommandListener); + @ConditionalOnMissingBean + MongoMetricsCommandListener mongoMetricsCommandListener(MeterRegistry meterRegistry, + MongoCommandTagsProvider mongoCommandTagsProvider) { + return new MongoMetricsCommandListener(meterRegistry, mongoCommandTagsProvider); } @Bean - @ConditionalOnBean(io.micrometer.core.instrument.binder.mongodb.MongoMetricsCommandListener.class) - MongoClientSettingsBuilderCustomizer mongoMetricsCommandListenerClientSettingsBuilderCustomizerBackwardsCompatible( - io.micrometer.core.instrument.binder.mongodb.MongoMetricsCommandListener mongoMetricsCommandListener) { + @ConditionalOnMissingBean + MongoCommandTagsProvider mongoCommandTagsProvider() { + return new DefaultMongoCommandTagsProvider(); + } + + @Bean + MongoClientSettingsBuilderCustomizer mongoMetricsCommandListenerClientSettingsBuilderCustomizer( + MongoMetricsCommandListener mongoMetricsCommandListener) { return (clientSettingsBuilder) -> clientSettingsBuilder.addCommandListener(mongoMetricsCommandListener); } } - @Configuration(proxyBeanMethods = false) @ConditionalOnClass(MongoMetricsConnectionPoolListener.class) @ConditionalOnProperty(name = "management.metrics.mongo.connectionpool.enabled", havingValue = "true", matchIfMissing = true) - @Import(MongoMetricsConnectionPoolListenerConfiguration.class) static class MongoConnectionPoolMetricsConfiguration { @Bean - @ConditionalOnBean(MongoMetricsConnectionPoolListener.class) - MongoClientSettingsBuilderCustomizer mongoMetricsConnectionPoolListenerClientSettingsBuilderCustomizer( - MongoMetricsConnectionPoolListener mongoMetricsConnectionPoolListener) { - return (clientSettingsBuilder) -> clientSettingsBuilder - .applyToConnectionPoolSettings((connectionPoolSettingsBuilder) -> connectionPoolSettingsBuilder - .addConnectionPoolListener(mongoMetricsConnectionPoolListener)); + @ConditionalOnMissingBean + MongoMetricsConnectionPoolListener mongoMetricsConnectionPoolListener(MeterRegistry meterRegistry, + MongoConnectionPoolTagsProvider mongoConnectionPoolTagsProvider) { + return new MongoMetricsConnectionPoolListener(meterRegistry, mongoConnectionPoolTagsProvider); } @Bean - @ConditionalOnBean(io.micrometer.core.instrument.binder.mongodb.MongoMetricsConnectionPoolListener.class) - MongoClientSettingsBuilderCustomizer mongoMetricsConnectionPoolListenerClientSettingsBuilderCustomizerBackwardsCompatible( - io.micrometer.core.instrument.binder.mongodb.MongoMetricsConnectionPoolListener mongoMetricsConnectionPoolListener) { + @ConditionalOnMissingBean + MongoConnectionPoolTagsProvider mongoConnectionPoolTagsProvider() { + return new DefaultMongoConnectionPoolTagsProvider(); + } + + @Bean + MongoClientSettingsBuilderCustomizer mongoMetricsConnectionPoolListenerClientSettingsBuilderCustomizer( + MongoMetricsConnectionPoolListener mongoMetricsConnectionPoolListener) { return (clientSettingsBuilder) -> clientSettingsBuilder .applyToConnectionPoolSettings((connectionPoolSettingsBuilder) -> connectionPoolSettingsBuilder .addConnectionPoolListener(mongoMetricsConnectionPoolListener)); diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/task/TaskExecutorMetricsAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/task/TaskExecutorMetricsAutoConfiguration.java index be30193c2c..e530be89bc 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/task/TaskExecutorMetricsAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/task/TaskExecutorMetricsAutoConfiguration.java @@ -21,8 +21,8 @@ import java.util.Map; import java.util.concurrent.Executor; import java.util.concurrent.ThreadPoolExecutor; -import io.micrometer.binder.jvm.ExecutorServiceMetrics; import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.binder.jvm.ExecutorServiceMetrics; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/jetty/JettyMetricsAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/jetty/JettyMetricsAutoConfiguration.java index 3a9d0871e8..4bd6eb69bf 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/jetty/JettyMetricsAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/jetty/JettyMetricsAutoConfiguration.java @@ -16,10 +16,10 @@ package org.springframework.boot.actuate.autoconfigure.metrics.web.jetty; -import io.micrometer.binder.jetty.JettyConnectionMetrics; -import io.micrometer.binder.jetty.JettyServerThreadPoolMetrics; -import io.micrometer.binder.jetty.JettySslHandshakeMetrics; import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.binder.jetty.JettyConnectionMetrics; +import io.micrometer.core.instrument.binder.jetty.JettyServerThreadPoolMetrics; +import io.micrometer.core.instrument.binder.jetty.JettySslHandshakeMetrics; import org.eclipse.jetty.server.Server; import org.springframework.boot.actuate.autoconfigure.metrics.CompositeMeterRegistryAutoConfiguration; @@ -46,29 +46,22 @@ import org.springframework.context.annotation.Bean; @ConditionalOnWebApplication @ConditionalOnClass({ JettyServerThreadPoolMetrics.class, Server.class }) @ConditionalOnBean(MeterRegistry.class) -@SuppressWarnings("deprecation") public class JettyMetricsAutoConfiguration { @Bean - @ConditionalOnMissingBean({ JettyServerThreadPoolMetrics.class, - io.micrometer.core.instrument.binder.jetty.JettyServerThreadPoolMetrics.class, - JettyServerThreadPoolMetricsBinder.class }) + @ConditionalOnMissingBean({ JettyServerThreadPoolMetrics.class, JettyServerThreadPoolMetricsBinder.class }) public JettyServerThreadPoolMetricsBinder jettyServerThreadPoolMetricsBinder(MeterRegistry meterRegistry) { return new JettyServerThreadPoolMetricsBinder(meterRegistry); } @Bean - @ConditionalOnMissingBean({ JettyConnectionMetrics.class, - io.micrometer.core.instrument.binder.jetty.JettyConnectionMetrics.class, - JettyConnectionMetricsBinder.class }) + @ConditionalOnMissingBean({ JettyConnectionMetrics.class, JettyConnectionMetricsBinder.class }) public JettyConnectionMetricsBinder jettyConnectionMetricsBinder(MeterRegistry meterRegistry) { return new JettyConnectionMetricsBinder(meterRegistry); } @Bean - @ConditionalOnMissingBean({ JettySslHandshakeMetrics.class, - io.micrometer.core.instrument.binder.jetty.JettySslHandshakeMetrics.class, - JettySslHandshakeMetricsBinder.class }) + @ConditionalOnMissingBean({ JettySslHandshakeMetrics.class, JettySslHandshakeMetricsBinder.class }) @ConditionalOnProperty(name = "server.ssl.enabled", havingValue = "true") public JettySslHandshakeMetricsBinder jettySslHandshakeMetricsBinder(MeterRegistry meterRegistry) { return new JettySslHandshakeMetricsBinder(meterRegistry); diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/tomcat/TomcatMetricsAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/tomcat/TomcatMetricsAutoConfiguration.java index 81c2d6c767..b5818258b8 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/tomcat/TomcatMetricsAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/web/tomcat/TomcatMetricsAutoConfiguration.java @@ -16,8 +16,8 @@ package org.springframework.boot.actuate.autoconfigure.metrics.web.tomcat; -import io.micrometer.binder.tomcat.TomcatMetrics; import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.binder.tomcat.TomcatMetrics; import org.apache.catalina.Manager; import org.springframework.boot.actuate.autoconfigure.metrics.CompositeMeterRegistryAutoConfiguration; @@ -39,13 +39,11 @@ import org.springframework.context.annotation.Bean; @AutoConfiguration(after = CompositeMeterRegistryAutoConfiguration.class) @ConditionalOnWebApplication @ConditionalOnClass({ TomcatMetrics.class, Manager.class }) -@SuppressWarnings("deprecation") public class TomcatMetricsAutoConfiguration { @Bean @ConditionalOnBean(MeterRegistry.class) - @ConditionalOnMissingBean({ TomcatMetrics.class, io.micrometer.core.instrument.binder.tomcat.TomcatMetrics.class, - TomcatMetricsBinder.class }) + @ConditionalOnMissingBean({ TomcatMetrics.class, TomcatMetricsBinder.class }) public TomcatMetricsBinder tomcatMetricsBinder(MeterRegistry meterRegistry) { return new TomcatMetricsBinder(meterRegistry); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/MetricsEndpointDocumentationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/MetricsEndpointDocumentationTests.java index e46f761b8b..6a179c3535 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/MetricsEndpointDocumentationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/MetricsEndpointDocumentationTests.java @@ -16,8 +16,8 @@ package org.springframework.boot.actuate.autoconfigure.endpoint.web.documentation; -import io.micrometer.binder.jvm.JvmMemoryMetrics; import io.micrometer.core.instrument.Statistic; +import io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics; import io.micrometer.core.instrument.simple.SimpleMeterRegistry; import org.junit.jupiter.api.Test; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/PrometheusScrapeEndpointDocumentationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/PrometheusScrapeEndpointDocumentationTests.java index a2df3d4446..128ff6033f 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/PrometheusScrapeEndpointDocumentationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/PrometheusScrapeEndpointDocumentationTests.java @@ -16,8 +16,8 @@ package org.springframework.boot.actuate.autoconfigure.endpoint.web.documentation; -import io.micrometer.binder.jvm.JvmMemoryMetrics; import io.micrometer.core.instrument.Clock; +import io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics; import io.micrometer.prometheus.PrometheusMeterRegistry; import io.prometheus.client.CollectorRegistry; import io.prometheus.client.exporter.common.TextFormat; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/JvmMetricsAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/JvmMetricsAutoConfigurationTests.java index ffc419fa4a..ecb3a5ad2a 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/JvmMetricsAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/JvmMetricsAutoConfigurationTests.java @@ -16,15 +16,11 @@ package org.springframework.boot.actuate.autoconfigure.metrics; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -import io.micrometer.binder.jvm.ClassLoaderMetrics; -import io.micrometer.binder.jvm.JvmGcMetrics; -import io.micrometer.binder.jvm.JvmHeapPressureMetrics; -import io.micrometer.binder.jvm.JvmMemoryMetrics; -import io.micrometer.binder.jvm.JvmThreadMetrics; +import io.micrometer.core.instrument.binder.jvm.ClassLoaderMetrics; +import io.micrometer.core.instrument.binder.jvm.JvmGcMetrics; +import io.micrometer.core.instrument.binder.jvm.JvmHeapPressureMetrics; +import io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics; +import io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics; import org.junit.jupiter.api.Test; import org.springframework.boot.actuate.autoconfigure.metrics.test.MetricsRun; @@ -59,98 +55,34 @@ class JvmMetricsAutoConfigurationTests { .run(assertMetricsBeans().andThen((context) -> assertThat(context).hasBean("customJvmGcMetrics"))); } - @Test - @Deprecated - void allowsCustomJvmGcMetricsToBeUsedBackwardsCompatible() { - this.contextRunner.withUserConfiguration(CustomJvmGcMetricsBackwardsCompatibleConfiguration.class) - .run(assertMetricsBeans(JvmGcMetrics.class).andThen((context) -> { - assertThat(context).hasBean("customJvmGcMetrics"); - assertThat(context).doesNotHaveBean(JvmGcMetrics.class); - assertThat(context).hasSingleBean(io.micrometer.core.instrument.binder.jvm.JvmGcMetrics.class); - })); - } - @Test void allowsCustomJvmHeapPressureMetricsToBeUsed() { this.contextRunner.withUserConfiguration(CustomJvmHeapPressureMetricsConfiguration.class).run( assertMetricsBeans().andThen((context) -> assertThat(context).hasBean("customJvmHeapPressureMetrics"))); } - @Test - @Deprecated - void allowsCustomJvmHeapPressureMetricsToBeUsedBackwardsCompatible() { - this.contextRunner.withUserConfiguration(CustomJvmHeapPressureMetricsBackwardsCompatibleConfiguration.class) - .run(assertMetricsBeans(JvmHeapPressureMetrics.class).andThen((context) -> { - assertThat(context).hasBean("customJvmHeapPressureMetrics"); - assertThat(context).doesNotHaveBean(JvmHeapPressureMetrics.class); - assertThat(context) - .hasSingleBean(io.micrometer.core.instrument.binder.jvm.JvmHeapPressureMetrics.class); - })); - } - @Test void allowsCustomJvmMemoryMetricsToBeUsed() { this.contextRunner.withUserConfiguration(CustomJvmMemoryMetricsConfiguration.class) .run(assertMetricsBeans().andThen((context) -> assertThat(context).hasBean("customJvmMemoryMetrics"))); } - @Test - @Deprecated - void allowsCustomJvmMemoryMetricsToBeUsedBackwardsCompatible() { - this.contextRunner.withUserConfiguration(CustomJvmMemoryMetricsBackwardsCompatibleConfiguration.class) - .run(assertMetricsBeans(JvmMemoryMetrics.class).andThen((context) -> { - assertThat(context).hasBean("customJvmMemoryMetrics"); - assertThat(context).doesNotHaveBean(JvmMemoryMetrics.class); - assertThat(context).hasSingleBean(io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics.class); - })); - } - @Test void allowsCustomJvmThreadMetricsToBeUsed() { this.contextRunner.withUserConfiguration(CustomJvmThreadMetricsConfiguration.class) .run(assertMetricsBeans().andThen((context) -> assertThat(context).hasBean("customJvmThreadMetrics"))); } - @Test - @Deprecated - void allowsCustomJvmThreadMetricsToBeUsedBackwardsCompatible() { - this.contextRunner.withUserConfiguration(CustomJvmThreadMetricsBackwardsCompatibleConfiguration.class) - .run(assertMetricsBeans(JvmThreadMetrics.class).andThen((context) -> { - assertThat(context).hasBean("customJvmThreadMetrics"); - assertThat(context).doesNotHaveBean(JvmThreadMetrics.class); - assertThat(context).hasSingleBean(io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics.class); - })); - } - @Test void allowsCustomClassLoaderMetricsToBeUsed() { this.contextRunner.withUserConfiguration(CustomClassLoaderMetricsConfiguration.class).run( assertMetricsBeans().andThen((context) -> assertThat(context).hasBean("customClassLoaderMetrics"))); } - @Test - @Deprecated - void allowsCustomClassLoaderMetricsToBeUsedBackwardsCompatible() { - this.contextRunner.withUserConfiguration(CustomClassLoaderMetricsBackwardsCompatibleConfiguration.class) - .run(assertMetricsBeans(ClassLoaderMetrics.class).andThen((context) -> { - assertThat(context).hasBean("customClassLoaderMetrics"); - assertThat(context).doesNotHaveBean(ClassLoaderMetrics.class); - assertThat(context) - .hasSingleBean(io.micrometer.core.instrument.binder.jvm.ClassLoaderMetrics.class); - })); - } - - private ContextConsumer assertMetricsBeans(Class... excludes) { - Set> beans = new HashSet<>(Arrays.asList(JvmGcMetrics.class, JvmHeapPressureMetrics.class, - JvmMemoryMetrics.class, JvmThreadMetrics.class, ClassLoaderMetrics.class)); - for (Class exclude : excludes) { - beans.remove(exclude); - } - return (context) -> { - for (Class bean : beans) { - assertThat(context).hasSingleBean(bean); - } - }; + private ContextConsumer assertMetricsBeans() { + return (context) -> assertThat(context).hasSingleBean(JvmGcMetrics.class) + .hasSingleBean(JvmHeapPressureMetrics.class).hasSingleBean(JvmMemoryMetrics.class) + .hasSingleBean(JvmThreadMetrics.class).hasSingleBean(ClassLoaderMetrics.class); } @Configuration(proxyBeanMethods = false) @@ -163,17 +95,6 @@ class JvmMetricsAutoConfigurationTests { } - @Configuration(proxyBeanMethods = false) - @SuppressWarnings("deprecation") - static class CustomJvmGcMetricsBackwardsCompatibleConfiguration { - - @Bean - io.micrometer.core.instrument.binder.jvm.JvmGcMetrics customJvmGcMetrics() { - return new io.micrometer.core.instrument.binder.jvm.JvmGcMetrics(); - } - - } - @Configuration(proxyBeanMethods = false) static class CustomJvmHeapPressureMetricsConfiguration { @@ -184,17 +105,6 @@ class JvmMetricsAutoConfigurationTests { } - @Configuration(proxyBeanMethods = false) - @SuppressWarnings("deprecation") - static class CustomJvmHeapPressureMetricsBackwardsCompatibleConfiguration { - - @Bean - io.micrometer.core.instrument.binder.jvm.JvmHeapPressureMetrics customJvmHeapPressureMetrics() { - return new io.micrometer.core.instrument.binder.jvm.JvmHeapPressureMetrics(); - } - - } - @Configuration(proxyBeanMethods = false) static class CustomJvmMemoryMetricsConfiguration { @@ -205,17 +115,6 @@ class JvmMetricsAutoConfigurationTests { } - @Configuration(proxyBeanMethods = false) - @SuppressWarnings("deprecation") - static class CustomJvmMemoryMetricsBackwardsCompatibleConfiguration { - - @Bean - io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics customJvmMemoryMetrics() { - return new io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics(); - } - - } - @Configuration(proxyBeanMethods = false) static class CustomJvmThreadMetricsConfiguration { @@ -226,17 +125,6 @@ class JvmMetricsAutoConfigurationTests { } - @Configuration(proxyBeanMethods = false) - @SuppressWarnings("deprecation") - static class CustomJvmThreadMetricsBackwardsCompatibleConfiguration { - - @Bean - io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics customJvmThreadMetrics() { - return new io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics(); - } - - } - @Configuration(proxyBeanMethods = false) static class CustomClassLoaderMetricsConfiguration { @@ -247,15 +135,4 @@ class JvmMetricsAutoConfigurationTests { } - @Configuration(proxyBeanMethods = false) - @SuppressWarnings("deprecation") - static class CustomClassLoaderMetricsBackwardsCompatibleConfiguration { - - @Bean - io.micrometer.core.instrument.binder.jvm.ClassLoaderMetrics customClassLoaderMetrics() { - return new io.micrometer.core.instrument.binder.jvm.ClassLoaderMetrics(); - } - - } - } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/Log4J2MetricsWithLog4jLoggerContextAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/Log4J2MetricsWithLog4jLoggerContextAutoConfigurationTests.java index 5934be9a0e..2e9a10bdb7 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/Log4J2MetricsWithLog4jLoggerContextAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/Log4J2MetricsWithLog4jLoggerContextAutoConfigurationTests.java @@ -16,7 +16,7 @@ package org.springframework.boot.actuate.autoconfigure.metrics; -import io.micrometer.binder.logging.Log4j2Metrics; +import io.micrometer.core.instrument.binder.logging.Log4j2Metrics; import org.apache.logging.log4j.LogManager; import org.junit.jupiter.api.Test; @@ -55,17 +55,6 @@ class Log4J2MetricsWithLog4jLoggerContextAutoConfigurationTests { (context) -> assertThat(context).hasSingleBean(Log4j2Metrics.class).hasBean("customLog4J2Metrics")); } - @Test - @Deprecated - void allowsCustomLog4J2MetricsToBeUsedBackwardsCompatible() { - assertThat(LogManager.getContext().getClass().getName()) - .isEqualTo("org.apache.logging.log4j.core.LoggerContext"); - this.contextRunner.withUserConfiguration(CustomLog4J2MetricsConfigurationBackwardsCompatible.class) - .run((context) -> assertThat(context) - .hasSingleBean(io.micrometer.core.instrument.binder.logging.Log4j2Metrics.class) - .doesNotHaveBean(Log4j2Metrics.class).hasBean("customLog4J2Metrics")); - } - @Configuration(proxyBeanMethods = false) static class CustomLog4J2MetricsConfiguration { @@ -76,15 +65,4 @@ class Log4J2MetricsWithLog4jLoggerContextAutoConfigurationTests { } - @Configuration(proxyBeanMethods = false) - @SuppressWarnings("deprecation") - static class CustomLog4J2MetricsConfigurationBackwardsCompatible { - - @Bean - io.micrometer.core.instrument.binder.logging.Log4j2Metrics customLog4J2Metrics() { - return new io.micrometer.core.instrument.binder.logging.Log4j2Metrics(); - } - - } - } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/Log4J2MetricsWithSlf4jLoggerContextAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/Log4J2MetricsWithSlf4jLoggerContextAutoConfigurationTests.java index 87c99a8191..1026186658 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/Log4J2MetricsWithSlf4jLoggerContextAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/Log4J2MetricsWithSlf4jLoggerContextAutoConfigurationTests.java @@ -16,7 +16,7 @@ package org.springframework.boot.actuate.autoconfigure.metrics; -import io.micrometer.binder.logging.Log4j2Metrics; +import io.micrometer.core.instrument.binder.logging.Log4j2Metrics; import org.apache.logging.log4j.LogManager; import org.apache.logging.slf4j.SLF4JLoggerContext; import org.junit.jupiter.api.Test; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/LogbackMetricsAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/LogbackMetricsAutoConfigurationTests.java index b0e38d4d8a..b8c3830183 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/LogbackMetricsAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/LogbackMetricsAutoConfigurationTests.java @@ -16,7 +16,7 @@ package org.springframework.boot.actuate.autoconfigure.metrics; -import io.micrometer.binder.logging.LogbackMetrics; +import io.micrometer.core.instrument.binder.logging.LogbackMetrics; import org.junit.jupiter.api.Test; import org.springframework.boot.actuate.autoconfigure.metrics.test.MetricsRun; @@ -49,15 +49,6 @@ class LogbackMetricsAutoConfigurationTests { (context) -> assertThat(context).hasSingleBean(LogbackMetrics.class).hasBean("customLogbackMetrics")); } - @Test - @Deprecated - void allowsCustomLogbackMetricsToBeUsedBackwardsCompatible() { - this.contextRunner.withUserConfiguration(CustomLogbackMetricsConfigurationBackwardsCompatible.class) - .run((context) -> assertThat(context) - .hasSingleBean(io.micrometer.core.instrument.binder.logging.LogbackMetrics.class) - .doesNotHaveBean(LogbackMetrics.class).hasBean("customLogbackMetrics")); - } - @Configuration(proxyBeanMethods = false) static class CustomLogbackMetricsConfiguration { @@ -68,15 +59,4 @@ class LogbackMetricsAutoConfigurationTests { } - @Configuration(proxyBeanMethods = false) - @SuppressWarnings("deprecation") - static class CustomLogbackMetricsConfigurationBackwardsCompatible { - - @Bean - io.micrometer.core.instrument.binder.logging.LogbackMetrics customLogbackMetrics() { - return new io.micrometer.core.instrument.binder.logging.LogbackMetrics(); - } - - } - } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsAutoConfigurationWithLog4j2AndLogbackTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsAutoConfigurationWithLog4j2AndLogbackTests.java index 4790f8c00e..7570c896c9 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsAutoConfigurationWithLog4j2AndLogbackTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/MetricsAutoConfigurationWithLog4j2AndLogbackTests.java @@ -16,7 +16,7 @@ package org.springframework.boot.actuate.autoconfigure.metrics; -import io.micrometer.binder.logging.LogbackMetrics; +import io.micrometer.core.instrument.binder.logging.LogbackMetrics; import org.junit.jupiter.api.Test; import org.springframework.boot.autoconfigure.AutoConfigurations; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/SystemMetricsAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/SystemMetricsAutoConfigurationTests.java index df6c955cfa..cba6e2c355 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/SystemMetricsAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/SystemMetricsAutoConfigurationTests.java @@ -20,10 +20,10 @@ import java.io.File; import java.util.Arrays; import java.util.Collections; -import io.micrometer.binder.system.FileDescriptorMetrics; -import io.micrometer.binder.system.ProcessorMetrics; -import io.micrometer.binder.system.UptimeMetrics; import io.micrometer.core.instrument.Tags; +import io.micrometer.core.instrument.binder.system.FileDescriptorMetrics; +import io.micrometer.core.instrument.binder.system.ProcessorMetrics; +import io.micrometer.core.instrument.binder.system.UptimeMetrics; import org.junit.jupiter.api.Test; import org.springframework.boot.actuate.autoconfigure.metrics.test.MetricsRun; @@ -58,15 +58,6 @@ class SystemMetricsAutoConfigurationTests { (context) -> assertThat(context).hasSingleBean(UptimeMetrics.class).hasBean("customUptimeMetrics")); } - @Test - @Deprecated - void allowsCustomUptimeMetricsToBeUsedBackwardsCompatible() { - this.contextRunner.withUserConfiguration(CustomUptimeMetricsConfigurationBackwardsCompatible.class) - .run((context) -> assertThat(context) - .hasSingleBean(io.micrometer.core.instrument.binder.system.UptimeMetrics.class) - .doesNotHaveBean(UptimeMetrics.class).hasBean("customUptimeMetrics")); - } - @Test void autoConfiguresProcessorMetrics() { this.contextRunner.run((context) -> assertThat(context).hasSingleBean(ProcessorMetrics.class)); @@ -79,15 +70,6 @@ class SystemMetricsAutoConfigurationTests { .hasBean("customProcessorMetrics")); } - @Test - @Deprecated - void allowsCustomProcessorMetricsToBeUsedBackwardsCompatible() { - this.contextRunner.withUserConfiguration(CustomProcessorMetricsConfigurationBackwardsCompatible.class) - .run((context) -> assertThat(context) - .hasSingleBean(io.micrometer.core.instrument.binder.system.ProcessorMetrics.class) - .doesNotHaveBean(ProcessorMetrics.class).hasBean("customProcessorMetrics")); - } - @Test void autoConfiguresFileDescriptorMetrics() { this.contextRunner.run((context) -> assertThat(context).hasSingleBean(FileDescriptorMetrics.class)); @@ -100,15 +82,6 @@ class SystemMetricsAutoConfigurationTests { .hasBean("customFileDescriptorMetrics")); } - @Test - @Deprecated - void allowsCustomFileDescriptorMetricsToBeUsedBackwardsCompatible() { - this.contextRunner.withUserConfiguration(CustomFileDescriptorMetricsConfigurationBackwardsCompatible.class) - .run((context) -> assertThat(context) - .hasSingleBean(io.micrometer.core.instrument.binder.system.FileDescriptorMetrics.class) - .doesNotHaveBean(FileDescriptorMetrics.class).hasBean("customFileDescriptorMetrics")); - } - @Test void autoConfiguresDiskSpaceMetrics() { this.contextRunner.run((context) -> assertThat(context).hasSingleBean(DiskSpaceMetricsBinder.class)); @@ -152,17 +125,6 @@ class SystemMetricsAutoConfigurationTests { } - @Configuration(proxyBeanMethods = false) - @SuppressWarnings("deprecation") - static class CustomUptimeMetricsConfigurationBackwardsCompatible { - - @Bean - io.micrometer.core.instrument.binder.system.UptimeMetrics customUptimeMetrics() { - return new io.micrometer.core.instrument.binder.system.UptimeMetrics(); - } - - } - @Configuration(proxyBeanMethods = false) static class CustomProcessorMetricsConfiguration { @@ -173,17 +135,6 @@ class SystemMetricsAutoConfigurationTests { } - @Configuration(proxyBeanMethods = false) - @SuppressWarnings("deprecation") - static class CustomProcessorMetricsConfigurationBackwardsCompatible { - - @Bean - io.micrometer.core.instrument.binder.system.ProcessorMetrics customProcessorMetrics() { - return new io.micrometer.core.instrument.binder.system.ProcessorMetrics(); - } - - } - @Configuration(proxyBeanMethods = false) static class CustomFileDescriptorMetricsConfiguration { @@ -194,17 +145,6 @@ class SystemMetricsAutoConfigurationTests { } - @Configuration(proxyBeanMethods = false) - @SuppressWarnings("deprecation") - static class CustomFileDescriptorMetricsConfigurationBackwardsCompatible { - - @Bean - io.micrometer.core.instrument.binder.system.FileDescriptorMetrics customFileDescriptorMetrics() { - return new io.micrometer.core.instrument.binder.system.FileDescriptorMetrics(); - } - - } - @Configuration(proxyBeanMethods = false) static class CustomDiskSpaceMetricsConfiguration { diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/humio/HumioMetricsExportAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/humio/HumioMetricsExportAutoConfigurationTests.java index 48e993f495..e15045fc8c 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/humio/HumioMetricsExportAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/humio/HumioMetricsExportAutoConfigurationTests.java @@ -16,8 +16,8 @@ package org.springframework.boot.actuate.autoconfigure.metrics.export.humio; -import io.micrometer.binder.jvm.JvmMemoryMetrics; import io.micrometer.core.instrument.Clock; +import io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics; import io.micrometer.humio.HumioConfig; import io.micrometer.humio.HumioMeterRegistry; import org.junit.jupiter.api.Test; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/jersey/JerseyServerMetricsAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/jersey/JerseyServerMetricsAutoConfigurationTests.java index 663abba27b..243076f6a7 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/jersey/JerseyServerMetricsAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/jersey/JerseyServerMetricsAutoConfigurationTests.java @@ -22,12 +22,12 @@ import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; -import io.micrometer.binder.jersey.server.DefaultJerseyTagsProvider; -import io.micrometer.binder.jersey.server.JerseyTagsProvider; -import io.micrometer.binder.jersey.server.MetricsApplicationEventListener; import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.Tag; import io.micrometer.core.instrument.Timer; +import io.micrometer.core.instrument.binder.jersey.server.DefaultJerseyTagsProvider; +import io.micrometer.core.instrument.binder.jersey.server.JerseyTagsProvider; +import io.micrometer.core.instrument.binder.jersey.server.MetricsApplicationEventListener; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.server.monitoring.RequestEvent; import org.junit.jupiter.api.Test; @@ -85,17 +85,6 @@ class JerseyServerMetricsAutoConfigurationTests { .run((context) -> assertThat(context).hasSingleBean(CustomJerseyTagsProvider.class)); } - @Test - @Deprecated - void shouldHonorExistingTagProviderBackwardsCompatible() { - this.webContextRunner.withUserConfiguration(CustomJerseyTagsProviderBackwardsCompatibleConfiguration.class) - .run((context) -> { - assertThat(context) - .hasSingleBean(io.micrometer.core.instrument.binder.jersey.server.JerseyTagsProvider.class); - assertThat(context).doesNotHaveBean(JerseyTagsProvider.class); - }); - } - @Test void httpRequestsAreTimed() { this.webContextRunner.run((context) -> { @@ -155,17 +144,6 @@ class JerseyServerMetricsAutoConfigurationTests { } - @Configuration(proxyBeanMethods = false) - @SuppressWarnings("deprecation") - static class CustomJerseyTagsProviderBackwardsCompatibleConfiguration { - - @Bean - io.micrometer.core.instrument.binder.jersey.server.JerseyTagsProvider customJerseyTagsProvider() { - return new CustomJerseyTagsProviderBackwardsCompatible(); - } - - } - static class CustomJerseyTagsProvider implements JerseyTagsProvider { @Override @@ -180,20 +158,4 @@ class JerseyServerMetricsAutoConfigurationTests { } - @SuppressWarnings("deprecation") - static class CustomJerseyTagsProviderBackwardsCompatible - implements io.micrometer.core.instrument.binder.jersey.server.JerseyTagsProvider { - - @Override - public Iterable httpRequestTags(RequestEvent event) { - return null; - } - - @Override - public Iterable httpLongRequestTags(RequestEvent event) { - return null; - } - - } - } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/mongo/MongoMetricsAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/mongo/MongoMetricsAutoConfigurationTests.java index ad7aba312b..43d96561b7 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/mongo/MongoMetricsAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/mongo/MongoMetricsAutoConfigurationTests.java @@ -23,12 +23,12 @@ import com.mongodb.client.MongoClient; import com.mongodb.client.internal.MongoClientImpl; import com.mongodb.connection.ConnectionPoolSettings; import com.mongodb.event.ConnectionPoolListener; -import io.micrometer.binder.mongodb.DefaultMongoCommandTagsProvider; -import io.micrometer.binder.mongodb.DefaultMongoConnectionPoolTagsProvider; -import io.micrometer.binder.mongodb.MongoCommandTagsProvider; -import io.micrometer.binder.mongodb.MongoConnectionPoolTagsProvider; -import io.micrometer.binder.mongodb.MongoMetricsCommandListener; -import io.micrometer.binder.mongodb.MongoMetricsConnectionPoolListener; +import io.micrometer.core.instrument.binder.mongodb.DefaultMongoCommandTagsProvider; +import io.micrometer.core.instrument.binder.mongodb.DefaultMongoConnectionPoolTagsProvider; +import io.micrometer.core.instrument.binder.mongodb.MongoCommandTagsProvider; +import io.micrometer.core.instrument.binder.mongodb.MongoConnectionPoolTagsProvider; +import io.micrometer.core.instrument.binder.mongodb.MongoMetricsCommandListener; +import io.micrometer.core.instrument.binder.mongodb.MongoMetricsConnectionPoolListener; import org.junit.jupiter.api.Test; import org.springframework.boot.actuate.autoconfigure.metrics.test.MetricsRun; @@ -93,7 +93,7 @@ class MongoMetricsAutoConfigurationTests { @Test void whenThereIsACustomMetricsCommandTagsProviderItIsUsed() { - MongoCommandTagsProvider customTagsProvider = mock(MongoCommandTagsProvider.class); + final MongoCommandTagsProvider customTagsProvider = mock(MongoCommandTagsProvider.class); this.contextRunner.with(MetricsRun.simple()) .withConfiguration(AutoConfigurations.of(MongoAutoConfiguration.class)) .withBean("customMongoCommandTagsProvider", MongoCommandTagsProvider.class, () -> customTagsProvider) @@ -101,27 +101,9 @@ class MongoMetricsAutoConfigurationTests { .isSameAs(customTagsProvider)); } - @Test - @Deprecated - void whenThereIsACustomMetricsCommandTagsProviderItIsUsedBackwardsCompatible() { - io.micrometer.core.instrument.binder.mongodb.MongoCommandTagsProvider customTagsProvider = mock( - io.micrometer.core.instrument.binder.mongodb.MongoCommandTagsProvider.class); - this.contextRunner.with(MetricsRun.simple()) - .withConfiguration(AutoConfigurations.of(MongoAutoConfiguration.class)) - .withBean("customMongoCommandTagsProvider", - io.micrometer.core.instrument.binder.mongodb.MongoCommandTagsProvider.class, - () -> customTagsProvider) - .run((context) -> { - assertThat(context).hasBean("customMongoCommandTagsProvider"); - assertThat(context) - .hasSingleBean(io.micrometer.core.instrument.binder.mongodb.MongoCommandTagsProvider.class); - assertThat(context).doesNotHaveBean(MongoCommandTagsProvider.class); - }); - } - @Test void whenThereIsACustomMetricsConnectionPoolTagsProviderItIsUsed() { - MongoConnectionPoolTagsProvider customTagsProvider = mock(MongoConnectionPoolTagsProvider.class); + final MongoConnectionPoolTagsProvider customTagsProvider = mock(MongoConnectionPoolTagsProvider.class); this.contextRunner.with(MetricsRun.simple()) .withConfiguration(AutoConfigurations.of(MongoAutoConfiguration.class)) .withBean("customMongoConnectionPoolTagsProvider", MongoConnectionPoolTagsProvider.class, @@ -130,25 +112,6 @@ class MongoMetricsAutoConfigurationTests { .isSameAs(customTagsProvider)); } - @Test - @Deprecated - void whenThereIsACustomMetricsConnectionPoolTagsProviderItIsUsedBackwardsCompatible() { - io.micrometer.core.instrument.binder.mongodb.MongoConnectionPoolTagsProvider customTagsProvider = mock( - io.micrometer.core.instrument.binder.mongodb.MongoConnectionPoolTagsProvider.class); - this.contextRunner.with(MetricsRun.simple()) - .withConfiguration(AutoConfigurations.of(MongoAutoConfiguration.class)) - .withBean("customMongoConnectionPoolTagsProvider", - io.micrometer.core.instrument.binder.mongodb.MongoConnectionPoolTagsProvider.class, - () -> customTagsProvider) - .run((context) -> { - assertThat(context).hasBean("customMongoConnectionPoolTagsProvider"); - assertThat(context).hasSingleBean( - io.micrometer.core.instrument.binder.mongodb.MongoConnectionPoolTagsProvider.class); - assertThat(context).doesNotHaveBean(MongoConnectionPoolTagsProvider.class); - - }); - } - @Test void whenThereIsNoMongoClientSettingsOnClasspathThenNoMetricsCommandListenerIsAdded() { this.contextRunner.with(MetricsRun.simple()) @@ -213,25 +176,26 @@ class MongoMetricsAutoConfigurationTests { } private MongoClientSettings getActualMongoClientSettingsUsedToConstructClient( - AssertableApplicationContext context) { - MongoClientImpl mongoClient = (MongoClientImpl) context.getBean(MongoClient.class); + final AssertableApplicationContext context) { + final MongoClientImpl mongoClient = (MongoClientImpl) context.getBean(MongoClient.class); return mongoClient.getSettings(); } - private List getConnectionPoolListenersFromClient(AssertableApplicationContext context) { + private List getConnectionPoolListenersFromClient( + final AssertableApplicationContext context) { MongoClientSettings mongoClientSettings = getActualMongoClientSettingsUsedToConstructClient(context); ConnectionPoolSettings connectionPoolSettings = mongoClientSettings.getConnectionPoolSettings(); return connectionPoolSettings.getConnectionPoolListeners(); } private MongoCommandTagsProvider getMongoCommandTagsProviderUsedToConstructListener( - AssertableApplicationContext context) { + final AssertableApplicationContext context) { MongoMetricsCommandListener listener = context.getBean(MongoMetricsCommandListener.class); return (MongoCommandTagsProvider) ReflectionTestUtils.getField(listener, "tagsProvider"); } private MongoConnectionPoolTagsProvider getMongoConnectionPoolTagsProviderUsedToConstructListener( - AssertableApplicationContext context) { + final AssertableApplicationContext context) { MongoMetricsConnectionPoolListener listener = context.getBean(MongoMetricsConnectionPoolListener.class); return (MongoConnectionPoolTagsProvider) ReflectionTestUtils.getField(listener, "tagsProvider"); } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/test/MetricsIntegrationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/test/MetricsIntegrationTests.java index 86f50f10b2..b5837f6495 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/test/MetricsIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/test/MetricsIntegrationTests.java @@ -24,11 +24,11 @@ import java.util.concurrent.CyclicBarrier; import javax.servlet.DispatcherType; -import io.micrometer.binder.jvm.JvmMemoryMetrics; -import io.micrometer.binder.logging.LogbackMetrics; import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.MockClock; import io.micrometer.core.instrument.binder.MeterBinder; +import io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics; +import io.micrometer.core.instrument.binder.logging.LogbackMetrics; import io.micrometer.core.instrument.simple.SimpleConfig; import io.micrometer.core.instrument.simple.SimpleMeterRegistry; import org.junit.jupiter.api.Test; diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/web/jetty/JettyMetricsAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/web/jetty/JettyMetricsAutoConfigurationTests.java index c249ffd807..cc2e1e5c1b 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/web/jetty/JettyMetricsAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/web/jetty/JettyMetricsAutoConfigurationTests.java @@ -16,13 +16,9 @@ package org.springframework.boot.actuate.autoconfigure.metrics.web.jetty; -import io.micrometer.binder.jetty.JettyConnectionMetrics; -import io.micrometer.binder.jetty.JettyServerThreadPoolMetrics; -import io.micrometer.binder.jetty.JettySslHandshakeMetrics; import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.Tags; import io.micrometer.core.instrument.simple.SimpleMeterRegistry; -import org.eclipse.jetty.util.thread.ThreadPool; import org.junit.jupiter.api.Test; import org.springframework.boot.SpringApplication; @@ -90,28 +86,6 @@ class JettyMetricsAutoConfigurationTests { .hasBean("customJettyServerThreadPoolMetricsBinder")); } - @Test - void allowsCustomJettyServerThreadPoolMetrics() { - new WebApplicationContextRunner().withConfiguration(AutoConfigurations.of(JettyMetricsAutoConfiguration.class)) - .withUserConfiguration(CustomJettyServerThreadPoolMetrics.class, MeterRegistryConfiguration.class) - .run((context) -> assertThat(context).hasSingleBean(JettyServerThreadPoolMetrics.class) - .doesNotHaveBean(JettyServerThreadPoolMetricsBinder.class) - .hasBean("customJettyServerThreadPoolMetrics")); - } - - @Test - @Deprecated - void allowsCustomJettyServerThreadPoolMetricsBackwardsCompatible() { - new WebApplicationContextRunner().withConfiguration(AutoConfigurations.of(JettyMetricsAutoConfiguration.class)) - .withUserConfiguration(CustomJettyServerThreadPoolMetricsBackwardsCompatible.class, - MeterRegistryConfiguration.class) - .run((context) -> assertThat(context) - .hasSingleBean(io.micrometer.core.instrument.binder.jetty.JettyServerThreadPoolMetrics.class) - .doesNotHaveBean(JettyServerThreadPoolMetrics.class) - .doesNotHaveBean(JettyServerThreadPoolMetricsBinder.class) - .hasBean("customJettyServerThreadPoolMetrics")); - } - @Test void autoConfiguresConnectionMetricsWithEmbeddedServletJetty() { new WebApplicationContextRunner(AnnotationConfigServletWebServerApplicationContext::new) @@ -156,26 +130,6 @@ class JettyMetricsAutoConfigurationTests { }); } - @Test - void allowsCustomJettyConnectionMetrics() { - new WebApplicationContextRunner().withConfiguration(AutoConfigurations.of(JettyMetricsAutoConfiguration.class)) - .withUserConfiguration(CustomJettyConnectionMetrics.class, MeterRegistryConfiguration.class) - .run((context) -> assertThat(context).hasSingleBean(JettyConnectionMetrics.class) - .doesNotHaveBean(JettyConnectionMetricsBinder.class).hasBean("customJettyConnectionMetrics")); - } - - @Test - @Deprecated - void allowsCustomJettyConnectionMetricsBackwardsCompatible() { - new WebApplicationContextRunner().withConfiguration(AutoConfigurations.of(JettyMetricsAutoConfiguration.class)) - .withUserConfiguration(CustomJettyConnectionMetricsBackwardsCompatible.class, - MeterRegistryConfiguration.class) - .run((context) -> assertThat(context) - .hasSingleBean(io.micrometer.core.instrument.binder.jetty.JettyConnectionMetrics.class) - .doesNotHaveBean(JettyConnectionMetrics.class) - .doesNotHaveBean(JettyConnectionMetricsBinder.class).hasBean("customJettyConnectionMetrics")); - } - @Test void autoConfiguresSslHandshakeMetricsWithEmbeddedServletJetty() { new WebApplicationContextRunner(AnnotationConfigServletWebServerApplicationContext::new) @@ -233,28 +187,6 @@ class JettyMetricsAutoConfigurationTests { .hasBean("customJettySslHandshakeMetricsBinder")); } - @Test - void allowsCustomJettySslHandshakeMetrics() { - new WebApplicationContextRunner().withConfiguration(AutoConfigurations.of(JettyMetricsAutoConfiguration.class)) - .withUserConfiguration(CustomJettySslHandshakeMetrics.class, MeterRegistryConfiguration.class) - .run((context) -> assertThat(context).hasSingleBean(JettySslHandshakeMetrics.class) - .doesNotHaveBean(JettySslHandshakeMetricsBinder.class) - .hasBean("customJettySslHandshakeMetrics")); - } - - @Test - @Deprecated - void allowsCustomJettySslHandshakeMetricsBackwardsCompatible() { - new WebApplicationContextRunner().withConfiguration(AutoConfigurations.of(JettyMetricsAutoConfiguration.class)) - .withUserConfiguration(CustomJettySslHandshakeMetricsBackwardsCompatible.class, - MeterRegistryConfiguration.class) - .run((context) -> assertThat(context) - .hasSingleBean(io.micrometer.core.instrument.binder.jetty.JettySslHandshakeMetrics.class) - .doesNotHaveBean(JettySslHandshakeMetrics.class) - .doesNotHaveBean(JettySslHandshakeMetricsBinder.class) - .hasBean("customJettySslHandshakeMetrics")); - } - @Test void doesNotAutoConfigureSslHandshakeMetricsWhenSslEnabledPropertyNotSpecified() { new WebApplicationContextRunner(AnnotationConfigServletWebServerApplicationContext::new) @@ -323,28 +255,6 @@ class JettyMetricsAutoConfigurationTests { } - @Configuration(proxyBeanMethods = false) - static class CustomJettyServerThreadPoolMetrics { - - @Bean - JettyServerThreadPoolMetrics customJettyServerThreadPoolMetrics() { - return new JettyServerThreadPoolMetrics(mock(ThreadPool.class), Tags.empty()); - } - - } - - @Configuration(proxyBeanMethods = false) - @SuppressWarnings("deprecation") - static class CustomJettyServerThreadPoolMetricsBackwardsCompatible { - - @Bean - io.micrometer.core.instrument.binder.jetty.JettyServerThreadPoolMetrics customJettyServerThreadPoolMetrics() { - return new io.micrometer.core.instrument.binder.jetty.JettyServerThreadPoolMetrics(mock(ThreadPool.class), - Tags.empty()); - } - - } - @Configuration(proxyBeanMethods = false) static class CustomJettyConnectionMetricsBinder { @@ -355,28 +265,6 @@ class JettyMetricsAutoConfigurationTests { } - @Configuration(proxyBeanMethods = false) - static class CustomJettyConnectionMetrics { - - @Bean - JettyConnectionMetrics customJettyConnectionMetrics(MeterRegistry meterRegistry) { - return new JettyConnectionMetrics(meterRegistry); - } - - } - - @Configuration(proxyBeanMethods = false) - @SuppressWarnings("deprecation") - static class CustomJettyConnectionMetricsBackwardsCompatible { - - @Bean - io.micrometer.core.instrument.binder.jetty.JettyConnectionMetrics customJettyConnectionMetrics( - MeterRegistry meterRegistry) { - return new io.micrometer.core.instrument.binder.jetty.JettyConnectionMetrics(meterRegistry); - } - - } - @Configuration(proxyBeanMethods = false) static class CustomJettySslHandshakeMetricsBinder { @@ -387,26 +275,4 @@ class JettyMetricsAutoConfigurationTests { } - @Configuration(proxyBeanMethods = false) - static class CustomJettySslHandshakeMetrics { - - @Bean - JettySslHandshakeMetrics customJettySslHandshakeMetrics(MeterRegistry meterRegistry) { - return new JettySslHandshakeMetrics(meterRegistry); - } - - } - - @Configuration(proxyBeanMethods = false) - @SuppressWarnings("deprecation") - static class CustomJettySslHandshakeMetricsBackwardsCompatible { - - @Bean - io.micrometer.core.instrument.binder.jetty.JettySslHandshakeMetrics customJettySslHandshakeMetrics( - MeterRegistry meterRegistry) { - return new io.micrometer.core.instrument.binder.jetty.JettySslHandshakeMetrics(meterRegistry); - } - - } - } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/web/tomcat/TomcatMetricsAutoConfigurationTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/web/tomcat/TomcatMetricsAutoConfigurationTests.java index 27d64a7161..1356e9ab5a 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/web/tomcat/TomcatMetricsAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/web/tomcat/TomcatMetricsAutoConfigurationTests.java @@ -19,8 +19,8 @@ package org.springframework.boot.actuate.autoconfigure.metrics.web.tomcat; import java.util.Collections; import java.util.concurrent.atomic.AtomicInteger; -import io.micrometer.binder.tomcat.TomcatMetrics; import io.micrometer.core.instrument.MeterRegistry; +import io.micrometer.core.instrument.binder.tomcat.TomcatMetrics; import io.micrometer.core.instrument.simple.SimpleMeterRegistry; import org.apache.tomcat.util.modeler.Registry; import org.junit.jupiter.api.Test; @@ -108,16 +108,6 @@ class TomcatMetricsAutoConfigurationTests { .hasBean("customTomcatMetrics")); } - @Test - @Deprecated - void allowsCustomTomcatMetricsToBeUsedBackwardsCompatible() { - new WebApplicationContextRunner().withConfiguration(AutoConfigurations.of(TomcatMetricsAutoConfiguration.class)) - .withUserConfiguration(MeterRegistryConfiguration.class, CustomTomcatMetricsBackwardsCompatible.class) - .run((context) -> assertThat(context).doesNotHaveBean(TomcatMetricsBinder.class) - .hasSingleBean(io.micrometer.core.instrument.binder.tomcat.TomcatMetrics.class) - .doesNotHaveBean(TomcatMetrics.class).hasBean("customTomcatMetrics")); - } - private ApplicationStartedEvent createApplicationStartedEvent(ConfigurableApplicationContext context) { return new ApplicationStartedEvent(new SpringApplication(), null, context, null); } @@ -174,17 +164,6 @@ class TomcatMetricsAutoConfigurationTests { } - @Configuration(proxyBeanMethods = false) - @SuppressWarnings("deprecation") - static class CustomTomcatMetricsBackwardsCompatible { - - @Bean - io.micrometer.core.instrument.binder.tomcat.TomcatMetrics customTomcatMetrics() { - return new io.micrometer.core.instrument.binder.tomcat.TomcatMetrics(null, Collections.emptyList()); - } - - } - @Configuration(proxyBeanMethods = false) static class CustomTomcatMetricsBinder { diff --git a/spring-boot-project/spring-boot-actuator/build.gradle b/spring-boot-project/spring-boot-actuator/build.gradle index e0d844ed1b..fbb0194c83 100644 --- a/spring-boot-project/spring-boot-actuator/build.gradle +++ b/spring-boot-project/spring-boot-actuator/build.gradle @@ -23,7 +23,6 @@ dependencies { optional("com.zaxxer:HikariCP") optional("io.lettuce:lettuce-core") optional("io.micrometer:micrometer-core") - optional("io.micrometer:micrometer-binders") optional("io.micrometer:micrometer-registry-prometheus") optional("io.prometheus:simpleclient_pushgateway") { exclude(group: "javax.xml.bind", module: "jaxb-api") diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/CaffeineCacheMeterBinderProvider.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/CaffeineCacheMeterBinderProvider.java index 71eb38bc42..120bb2a06a 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/CaffeineCacheMeterBinderProvider.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/CaffeineCacheMeterBinderProvider.java @@ -16,9 +16,9 @@ package org.springframework.boot.actuate.metrics.cache; -import io.micrometer.binder.cache.CaffeineCacheMetrics; import io.micrometer.core.instrument.Tag; import io.micrometer.core.instrument.binder.MeterBinder; +import io.micrometer.core.instrument.binder.cache.CaffeineCacheMetrics; import org.springframework.cache.caffeine.CaffeineCache; diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/EhCache2CacheMeterBinderProvider.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/EhCache2CacheMeterBinderProvider.java index af666f4e9b..11cd4f6219 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/EhCache2CacheMeterBinderProvider.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/EhCache2CacheMeterBinderProvider.java @@ -16,9 +16,9 @@ package org.springframework.boot.actuate.metrics.cache; -import io.micrometer.binder.cache.EhCache2Metrics; import io.micrometer.core.instrument.Tag; import io.micrometer.core.instrument.binder.MeterBinder; +import io.micrometer.core.instrument.binder.cache.EhCache2Metrics; import org.springframework.cache.ehcache.EhCacheCache; diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/HazelcastCacheMeterBinderProvider.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/HazelcastCacheMeterBinderProvider.java index f280cbe997..92894ec0f4 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/HazelcastCacheMeterBinderProvider.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/HazelcastCacheMeterBinderProvider.java @@ -19,9 +19,9 @@ package org.springframework.boot.actuate.metrics.cache; import java.lang.reflect.Method; import com.hazelcast.spring.cache.HazelcastCache; -import io.micrometer.binder.cache.HazelcastCacheMetrics; import io.micrometer.core.instrument.Tag; import io.micrometer.core.instrument.binder.MeterBinder; +import io.micrometer.core.instrument.binder.cache.HazelcastCacheMetrics; import org.springframework.util.ReflectionUtils; diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/JCacheCacheMeterBinderProvider.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/JCacheCacheMeterBinderProvider.java index 5e91fb0f1e..32550e45f8 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/JCacheCacheMeterBinderProvider.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/JCacheCacheMeterBinderProvider.java @@ -16,9 +16,9 @@ package org.springframework.boot.actuate.metrics.cache; -import io.micrometer.binder.cache.JCacheMetrics; import io.micrometer.core.instrument.Tag; import io.micrometer.core.instrument.binder.MeterBinder; +import io.micrometer.core.instrument.binder.cache.JCacheMetrics; import org.springframework.cache.jcache.JCacheCache; diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/system/DiskSpaceMetricsBinder.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/system/DiskSpaceMetricsBinder.java index b5eba5f8a1..d2bcf25ce0 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/system/DiskSpaceMetricsBinder.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/system/DiskSpaceMetricsBinder.java @@ -19,10 +19,10 @@ package org.springframework.boot.actuate.metrics.system; import java.io.File; import java.util.List; -import io.micrometer.binder.system.DiskSpaceMetrics; import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.Tag; import io.micrometer.core.instrument.binder.MeterBinder; +import io.micrometer.core.instrument.binder.system.DiskSpaceMetrics; import org.springframework.util.Assert; diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/jetty/JettyConnectionMetricsBinder.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/jetty/JettyConnectionMetricsBinder.java index 662dd2ad23..2f3483da58 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/jetty/JettyConnectionMetricsBinder.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/jetty/JettyConnectionMetricsBinder.java @@ -18,9 +18,9 @@ package org.springframework.boot.actuate.metrics.web.jetty; import java.util.Collections; -import io.micrometer.binder.jetty.JettyConnectionMetrics; import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.Tag; +import io.micrometer.core.instrument.binder.jetty.JettyConnectionMetrics; import org.eclipse.jetty.server.Server; /** diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/jetty/JettyServerThreadPoolMetricsBinder.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/jetty/JettyServerThreadPoolMetricsBinder.java index 4801f05ebd..2297b4f96a 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/jetty/JettyServerThreadPoolMetricsBinder.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/jetty/JettyServerThreadPoolMetricsBinder.java @@ -18,9 +18,9 @@ package org.springframework.boot.actuate.metrics.web.jetty; import java.util.Collections; -import io.micrometer.binder.jetty.JettyServerThreadPoolMetrics; import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.Tag; +import io.micrometer.core.instrument.binder.jetty.JettyServerThreadPoolMetrics; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.util.thread.ThreadPool; diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/jetty/JettySslHandshakeMetricsBinder.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/jetty/JettySslHandshakeMetricsBinder.java index f590d24ffe..f4c81814a0 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/jetty/JettySslHandshakeMetricsBinder.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/jetty/JettySslHandshakeMetricsBinder.java @@ -18,9 +18,9 @@ package org.springframework.boot.actuate.metrics.web.jetty; import java.util.Collections; -import io.micrometer.binder.jetty.JettySslHandshakeMetrics; import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.Tag; +import io.micrometer.core.instrument.binder.jetty.JettySslHandshakeMetrics; import org.eclipse.jetty.server.Server; /** diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/tomcat/TomcatMetricsBinder.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/tomcat/TomcatMetricsBinder.java index 1de4181eda..45ad5a4acf 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/tomcat/TomcatMetricsBinder.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/tomcat/TomcatMetricsBinder.java @@ -18,9 +18,9 @@ package org.springframework.boot.actuate.metrics.web.tomcat; import java.util.Collections; -import io.micrometer.binder.tomcat.TomcatMetrics; import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.Tag; +import io.micrometer.core.instrument.binder.tomcat.TomcatMetrics; import org.apache.catalina.Container; import org.apache.catalina.Context; import org.apache.catalina.Manager; diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/MetricsEndpointWebIntegrationTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/MetricsEndpointWebIntegrationTests.java index 583cae0258..b29425aeab 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/MetricsEndpointWebIntegrationTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/MetricsEndpointWebIntegrationTests.java @@ -21,9 +21,9 @@ import java.util.List; import java.util.Map; import com.fasterxml.jackson.databind.ObjectMapper; -import io.micrometer.binder.jvm.JvmMemoryMetrics; import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.MockClock; +import io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics; import io.micrometer.core.instrument.simple.SimpleConfig; import io.micrometer.core.instrument.simple.SimpleMeterRegistry; diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/CaffeineCacheMeterBinderProviderTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/CaffeineCacheMeterBinderProviderTests.java index d4246cf340..bca5ce345b 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/CaffeineCacheMeterBinderProviderTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/CaffeineCacheMeterBinderProviderTests.java @@ -19,8 +19,8 @@ package org.springframework.boot.actuate.metrics.cache; import java.util.Collections; import com.github.benmanes.caffeine.cache.Caffeine; -import io.micrometer.binder.cache.CaffeineCacheMetrics; import io.micrometer.core.instrument.binder.MeterBinder; +import io.micrometer.core.instrument.binder.cache.CaffeineCacheMetrics; import org.junit.jupiter.api.Test; import org.springframework.cache.caffeine.CaffeineCache; diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/EhCache2CacheMeterBinderProviderTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/EhCache2CacheMeterBinderProviderTests.java index 689c581bfa..dd5e46d7ee 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/EhCache2CacheMeterBinderProviderTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/EhCache2CacheMeterBinderProviderTests.java @@ -18,8 +18,8 @@ package org.springframework.boot.actuate.metrics.cache; import java.util.Collections; -import io.micrometer.binder.cache.EhCache2Metrics; import io.micrometer.core.instrument.binder.MeterBinder; +import io.micrometer.core.instrument.binder.cache.EhCache2Metrics; import net.sf.ehcache.Cache; import net.sf.ehcache.CacheManager; import net.sf.ehcache.config.CacheConfiguration; diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/HazelcastCacheMeterBinderProviderTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/HazelcastCacheMeterBinderProviderTests.java index d5b57e21a4..737e8b855b 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/HazelcastCacheMeterBinderProviderTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/HazelcastCacheMeterBinderProviderTests.java @@ -20,8 +20,8 @@ import java.util.Collections; import com.hazelcast.map.IMap; import com.hazelcast.spring.cache.HazelcastCache; -import io.micrometer.binder.cache.HazelcastCacheMetrics; import io.micrometer.core.instrument.binder.MeterBinder; +import io.micrometer.core.instrument.binder.cache.HazelcastCacheMetrics; import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/JCacheCacheMeterBinderProviderTests.java b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/JCacheCacheMeterBinderProviderTests.java index 8d9a8f0015..919dc5bb06 100644 --- a/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/JCacheCacheMeterBinderProviderTests.java +++ b/spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/cache/JCacheCacheMeterBinderProviderTests.java @@ -20,8 +20,8 @@ import java.net.URI; import java.net.URISyntaxException; import java.util.Collections; -import io.micrometer.binder.cache.JCacheMetrics; import io.micrometer.core.instrument.binder.MeterBinder; +import io.micrometer.core.instrument.binder.cache.JCacheMetrics; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index 7423470fef..65eccc284d 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -1280,9 +1280,6 @@ bom { } } library("Micrometer", "1.9.0-SNAPSHOT") { - prohibit("[2.0.0-M1,)") { - because "we upgrade in Spring Boot 3.x" - } group("io.micrometer") { modules = [ "micrometer-registry-stackdriver" { diff --git a/spring-boot-project/spring-boot-docs/build.gradle b/spring-boot-project/spring-boot-docs/build.gradle index 75fd601294..62e969f64c 100644 --- a/spring-boot-project/spring-boot-docs/build.gradle +++ b/spring-boot-project/spring-boot-docs/build.gradle @@ -77,7 +77,6 @@ dependencies { implementation("ch.qos.logback:logback-classic") implementation("com.zaxxer:HikariCP") implementation("io.micrometer:micrometer-core") - implementation("io.micrometer:micrometer-binders") implementation("io.micrometer:micrometer-registry-graphite") implementation("io.micrometer:micrometer-registry-jmx") implementation("io.projectreactor.netty:reactor-netty-http") diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/actuator/metrics/supported/mongodb/command/CustomCommandTagsProvider.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/actuator/metrics/supported/mongodb/command/CustomCommandTagsProvider.java index 17b85d18f0..41014d0ab7 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/actuator/metrics/supported/mongodb/command/CustomCommandTagsProvider.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/actuator/metrics/supported/mongodb/command/CustomCommandTagsProvider.java @@ -17,8 +17,8 @@ package org.springframework.boot.docs.actuator.metrics.supported.mongodb.command; import com.mongodb.event.CommandEvent; -import io.micrometer.binder.mongodb.MongoCommandTagsProvider; import io.micrometer.core.instrument.Tag; +import io.micrometer.core.instrument.binder.mongodb.MongoCommandTagsProvider; class CustomCommandTagsProvider implements MongoCommandTagsProvider { diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/actuator/metrics/supported/mongodb/command/MyCommandTagsProviderConfiguration.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/actuator/metrics/supported/mongodb/command/MyCommandTagsProviderConfiguration.java index c236945c7a..ab651b4bf5 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/actuator/metrics/supported/mongodb/command/MyCommandTagsProviderConfiguration.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/actuator/metrics/supported/mongodb/command/MyCommandTagsProviderConfiguration.java @@ -16,7 +16,7 @@ package org.springframework.boot.docs.actuator.metrics.supported.mongodb.command; -import io.micrometer.binder.mongodb.MongoCommandTagsProvider; +import io.micrometer.core.instrument.binder.mongodb.MongoCommandTagsProvider; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/actuator/metrics/supported/mongodb/connectionpool/CustomConnectionPoolTagsProvider.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/actuator/metrics/supported/mongodb/connectionpool/CustomConnectionPoolTagsProvider.java index fa1dee5db1..24009433f4 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/actuator/metrics/supported/mongodb/connectionpool/CustomConnectionPoolTagsProvider.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/actuator/metrics/supported/mongodb/connectionpool/CustomConnectionPoolTagsProvider.java @@ -17,8 +17,8 @@ package org.springframework.boot.docs.actuator.metrics.supported.mongodb.connectionpool; import com.mongodb.event.ConnectionPoolCreatedEvent; -import io.micrometer.binder.mongodb.MongoConnectionPoolTagsProvider; import io.micrometer.core.instrument.Tag; +import io.micrometer.core.instrument.binder.mongodb.MongoConnectionPoolTagsProvider; public class CustomConnectionPoolTagsProvider implements MongoConnectionPoolTagsProvider { diff --git a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/actuator/metrics/supported/mongodb/connectionpool/MyConnectionPoolTagsProviderConfiguration.java b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/actuator/metrics/supported/mongodb/connectionpool/MyConnectionPoolTagsProviderConfiguration.java index 0d6954fba2..8e4d09cbd0 100644 --- a/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/actuator/metrics/supported/mongodb/connectionpool/MyConnectionPoolTagsProviderConfiguration.java +++ b/spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/actuator/metrics/supported/mongodb/connectionpool/MyConnectionPoolTagsProviderConfiguration.java @@ -16,7 +16,7 @@ package org.springframework.boot.docs.actuator.metrics.supported.mongodb.connectionpool; -import io.micrometer.binder.mongodb.MongoConnectionPoolTagsProvider; +import io.micrometer.core.instrument.binder.mongodb.MongoConnectionPoolTagsProvider; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/actuator/metrics/supported/mongodb/command/CustomCommandTagsProvider.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/actuator/metrics/supported/mongodb/command/CustomCommandTagsProvider.kt index 34ce16d9ff..7c49e6e6c4 100644 --- a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/actuator/metrics/supported/mongodb/command/CustomCommandTagsProvider.kt +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/actuator/metrics/supported/mongodb/command/CustomCommandTagsProvider.kt @@ -17,8 +17,8 @@ package org.springframework.boot.docs.actuator.metrics.supported.mongodb.command import com.mongodb.event.CommandEvent -import io.micrometer.binder.mongodb.MongoCommandTagsProvider import io.micrometer.core.instrument.Tag +import io.micrometer.core.instrument.binder.mongodb.MongoCommandTagsProvider class CustomCommandTagsProvider : MongoCommandTagsProvider { @@ -26,4 +26,4 @@ class CustomCommandTagsProvider : MongoCommandTagsProvider { return emptyList() } -} +} \ No newline at end of file diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/actuator/metrics/supported/mongodb/command/MyCommandTagsProviderConfiguration.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/actuator/metrics/supported/mongodb/command/MyCommandTagsProviderConfiguration.kt index 796ad6dad5..f412eefcad 100644 --- a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/actuator/metrics/supported/mongodb/command/MyCommandTagsProviderConfiguration.kt +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/actuator/metrics/supported/mongodb/command/MyCommandTagsProviderConfiguration.kt @@ -16,7 +16,7 @@ package org.springframework.boot.docs.actuator.metrics.supported.mongodb.command -import io.micrometer.binder.mongodb.MongoCommandTagsProvider +import io.micrometer.core.instrument.binder.mongodb.MongoCommandTagsProvider import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration @@ -28,4 +28,4 @@ class MyCommandTagsProviderConfiguration { return CustomCommandTagsProvider() } -} +} \ No newline at end of file diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/actuator/metrics/supported/mongodb/connectionpool/CustomConnectionPoolTagsProvider.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/actuator/metrics/supported/mongodb/connectionpool/CustomConnectionPoolTagsProvider.kt index f05a1fdf56..b84dcc695c 100644 --- a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/actuator/metrics/supported/mongodb/connectionpool/CustomConnectionPoolTagsProvider.kt +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/actuator/metrics/supported/mongodb/connectionpool/CustomConnectionPoolTagsProvider.kt @@ -17,8 +17,8 @@ package org.springframework.boot.docs.actuator.metrics.supported.mongodb.connectionpool import com.mongodb.event.ConnectionPoolCreatedEvent -import io.micrometer.binder.mongodb.MongoConnectionPoolTagsProvider import io.micrometer.core.instrument.Tag +import io.micrometer.core.instrument.binder.mongodb.MongoConnectionPoolTagsProvider class CustomConnectionPoolTagsProvider : MongoConnectionPoolTagsProvider { @@ -26,4 +26,4 @@ class CustomConnectionPoolTagsProvider : MongoConnectionPoolTagsProvider { return emptyList() } -} +} \ No newline at end of file diff --git a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/actuator/metrics/supported/mongodb/connectionpool/MyConnectionPoolTagsProviderConfiguration.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/actuator/metrics/supported/mongodb/connectionpool/MyConnectionPoolTagsProviderConfiguration.kt index 260b889cbb..49a40e46da 100644 --- a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/actuator/metrics/supported/mongodb/connectionpool/MyConnectionPoolTagsProviderConfiguration.kt +++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/actuator/metrics/supported/mongodb/connectionpool/MyConnectionPoolTagsProviderConfiguration.kt @@ -16,7 +16,7 @@ package org.springframework.boot.docs.actuator.metrics.supported.mongodb.connectionpool -import io.micrometer.binder.mongodb.MongoConnectionPoolTagsProvider +import io.micrometer.core.instrument.binder.mongodb.MongoConnectionPoolTagsProvider import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration @@ -28,4 +28,4 @@ class MyConnectionPoolTagsProviderConfiguration { return CustomConnectionPoolTagsProvider() } -} +} \ No newline at end of file diff --git a/spring-boot-project/spring-boot-starters/spring-boot-starter-actuator/build.gradle b/spring-boot-project/spring-boot-starters/spring-boot-starter-actuator/build.gradle index fc3ad62564..4c4d4c9089 100644 --- a/spring-boot-project/spring-boot-starters/spring-boot-starter-actuator/build.gradle +++ b/spring-boot-project/spring-boot-starters/spring-boot-starter-actuator/build.gradle @@ -8,5 +8,4 @@ dependencies { api(project(":spring-boot-project:spring-boot-starters:spring-boot-starter")) api(project(":spring-boot-project:spring-boot-actuator-autoconfigure")) api("io.micrometer:micrometer-core") - api("io.micrometer:micrometer-binders") } diff --git a/spring-boot-project/spring-boot-test-autoconfigure/build.gradle b/spring-boot-project/spring-boot-test-autoconfigure/build.gradle index 4ff97e59a5..000ab1ebfc 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/build.gradle +++ b/spring-boot-project/spring-boot-test-autoconfigure/build.gradle @@ -84,7 +84,6 @@ dependencies { testImplementation("com.unboundid:unboundid-ldapsdk") testImplementation("io.lettuce:lettuce-core") testImplementation("io.micrometer:micrometer-registry-prometheus") - testImplementation("io.micrometer:micrometer-binders") testImplementation("io.projectreactor.netty:reactor-netty-http") testImplementation("io.projectreactor:reactor-core") testImplementation("io.projectreactor:reactor-test")