diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle b/spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle
index 1652458515..a9dacf5142 100644
--- a/spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle
+++ b/spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle
@@ -48,6 +48,7 @@ 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 929b7024bf..6ad1a24ab6 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;
@@ -42,31 +42,35 @@ import org.springframework.context.annotation.Bean;
public class JvmMetricsAutoConfiguration {
@Bean
- @ConditionalOnMissingBean
+ @ConditionalOnMissingBean({ JvmGcMetrics.class, io.micrometer.core.instrument.binder.jvm.JvmGcMetrics.class })
public JvmGcMetrics jvmGcMetrics() {
return new JvmGcMetrics();
}
@Bean
- @ConditionalOnMissingBean
+ @ConditionalOnMissingBean({ JvmHeapPressureMetrics.class,
+ io.micrometer.core.instrument.binder.jvm.JvmHeapPressureMetrics.class })
public JvmHeapPressureMetrics jvmHeapPressureMetrics() {
return new JvmHeapPressureMetrics();
}
@Bean
- @ConditionalOnMissingBean
+ @ConditionalOnMissingBean({ JvmMemoryMetrics.class,
+ io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics.class })
public JvmMemoryMetrics jvmMemoryMetrics() {
return new JvmMemoryMetrics();
}
@Bean
- @ConditionalOnMissingBean
+ @ConditionalOnMissingBean({ JvmThreadMetrics.class,
+ io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics.class })
public JvmThreadMetrics jvmThreadMetrics() {
return new JvmThreadMetrics();
}
@Bean
- @ConditionalOnMissingBean
+ @ConditionalOnMissingBean({ ClassLoaderMetrics.class,
+ io.micrometer.core.instrument.binder.jvm.ClassLoaderMetrics.class })
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 fc5c39ca77..31842b7e58 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 d2039e0466..2dfbf4da59 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;
@@ -47,7 +47,7 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
public class Log4J2MetricsAutoConfiguration {
@Bean
- @ConditionalOnMissingBean
+ @ConditionalOnMissingBean({ Log4j2Metrics.class, io.micrometer.core.instrument.binder.logging.Log4j2Metrics.class })
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 8a76340ff2..c77421d30c 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;
@@ -49,7 +49,8 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
public class LogbackMetricsAutoConfiguration {
@Bean
- @ConditionalOnMissingBean
+ @ConditionalOnMissingBean({ LogbackMetrics.class,
+ io.micrometer.core.instrument.binder.logging.LogbackMetrics.class })
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 30111b97e8..eb968bbe6b 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;
@@ -48,19 +48,21 @@ import org.springframework.context.annotation.Bean;
public class SystemMetricsAutoConfiguration {
@Bean
- @ConditionalOnMissingBean
+ @ConditionalOnMissingBean({ UptimeMetrics.class, io.micrometer.core.instrument.binder.system.UptimeMetrics.class })
public UptimeMetrics uptimeMetrics() {
return new UptimeMetrics();
}
@Bean
- @ConditionalOnMissingBean
+ @ConditionalOnMissingBean({ ProcessorMetrics.class,
+ io.micrometer.core.instrument.binder.system.ProcessorMetrics.class })
public ProcessorMetrics processorMetrics() {
return new ProcessorMetrics();
}
@Bean
- @ConditionalOnMissingBean
+ @ConditionalOnMissingBean({ FileDescriptorMetrics.class,
+ io.micrometer.core.instrument.binder.system.FileDescriptorMetrics.class })
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
new file mode 100644
index 0000000000..c6495912e0
--- /dev/null
+++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/jersey/JerseyConfigurations.java
@@ -0,0 +1,43 @@
+/*
+ * 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
+ */
+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 382d71daf9..9c9c88704b 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,11 +19,10 @@ 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;
@@ -32,15 +31,16 @@ 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,6 +57,7 @@ import org.springframework.core.annotation.Order;
@ConditionalOnClass({ ResourceConfig.class, MetricsApplicationEventListener.class })
@ConditionalOnBean({ MeterRegistry.class, ResourceConfig.class })
@EnableConfigurationProperties(MetricsProperties.class)
+@Import(JerseyTagsProviderConfiguration.class)
public class JerseyServerMetricsAutoConfiguration {
private final MetricsProperties properties;
@@ -66,12 +67,7 @@ public class JerseyServerMetricsAutoConfiguration {
}
@Bean
- @ConditionalOnMissingBean(JerseyTagsProvider.class)
- public DefaultJerseyTagsProvider jerseyTagsProvider() {
- return new DefaultJerseyTagsProvider();
- }
-
- @Bean
+ @ConditionalOnBean(JerseyTagsProvider.class)
public ResourceConfigCustomizer jerseyServerMetricsResourceConfigCustomizer(MeterRegistry meterRegistry,
JerseyTagsProvider tagsProvider) {
Server server = this.properties.getWeb().getServer();
@@ -80,6 +76,19 @@ 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() {
@@ -102,4 +111,18 @@ 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
new file mode 100644
index 0000000000..0f83c1c376
--- /dev/null
+++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/mongo/MongoConfigurations.java
@@ -0,0 +1,116 @@
+/*
+ * 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
+ */
+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 1e448b46f0..c859f77cdf 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,31 +17,31 @@
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,
@@ -50,53 +50,49 @@ import org.springframework.context.annotation.Bean;
@ConditionalOnBean(MeterRegistry.class)
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
- @ConditionalOnMissingBean
- MongoMetricsCommandListener mongoMetricsCommandListener(MeterRegistry meterRegistry,
- MongoCommandTagsProvider mongoCommandTagsProvider) {
- return new MongoMetricsCommandListener(meterRegistry, mongoCommandTagsProvider);
- }
-
- @Bean
- @ConditionalOnMissingBean
- MongoCommandTagsProvider mongoCommandTagsProvider() {
- return new DefaultMongoCommandTagsProvider();
+ @ConditionalOnBean(MongoMetricsCommandListener.class)
+ MongoClientSettingsBuilderCustomizer mongoMetricsCommandListenerClientSettingsBuilderCustomizer(
+ MongoMetricsCommandListener mongoMetricsCommandListener) {
+ return (clientSettingsBuilder) -> clientSettingsBuilder.addCommandListener(mongoMetricsCommandListener);
}
@Bean
- MongoClientSettingsBuilderCustomizer mongoMetricsCommandListenerClientSettingsBuilderCustomizer(
- MongoMetricsCommandListener mongoMetricsCommandListener) {
+ @ConditionalOnBean(io.micrometer.core.instrument.binder.mongodb.MongoMetricsCommandListener.class)
+ MongoClientSettingsBuilderCustomizer mongoMetricsCommandListenerClientSettingsBuilderCustomizerBackwardsCompatible(
+ io.micrometer.core.instrument.binder.mongodb.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
- @ConditionalOnMissingBean
- MongoMetricsConnectionPoolListener mongoMetricsConnectionPoolListener(MeterRegistry meterRegistry,
- MongoConnectionPoolTagsProvider mongoConnectionPoolTagsProvider) {
- return new MongoMetricsConnectionPoolListener(meterRegistry, mongoConnectionPoolTagsProvider);
- }
-
- @Bean
- @ConditionalOnMissingBean
- MongoConnectionPoolTagsProvider mongoConnectionPoolTagsProvider() {
- return new DefaultMongoConnectionPoolTagsProvider();
+ @ConditionalOnBean(MongoMetricsConnectionPoolListener.class)
+ MongoClientSettingsBuilderCustomizer mongoMetricsConnectionPoolListenerClientSettingsBuilderCustomizer(
+ MongoMetricsConnectionPoolListener mongoMetricsConnectionPoolListener) {
+ return (clientSettingsBuilder) -> clientSettingsBuilder
+ .applyToConnectionPoolSettings((connectionPoolSettingsBuilder) -> connectionPoolSettingsBuilder
+ .addConnectionPoolListener(mongoMetricsConnectionPoolListener));
}
@Bean
- MongoClientSettingsBuilderCustomizer mongoMetricsConnectionPoolListenerClientSettingsBuilderCustomizer(
- MongoMetricsConnectionPoolListener mongoMetricsConnectionPoolListener) {
+ @ConditionalOnBean(io.micrometer.core.instrument.binder.mongodb.MongoMetricsConnectionPoolListener.class)
+ MongoClientSettingsBuilderCustomizer mongoMetricsConnectionPoolListenerClientSettingsBuilderCustomizerBackwardsCompatible(
+ io.micrometer.core.instrument.binder.mongodb.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 e530be89bc..be30193c2c 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 4bd6eb69bf..8e1a526271 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;
@@ -49,19 +49,25 @@ import org.springframework.context.annotation.Bean;
public class JettyMetricsAutoConfiguration {
@Bean
- @ConditionalOnMissingBean({ JettyServerThreadPoolMetrics.class, JettyServerThreadPoolMetricsBinder.class })
+ @ConditionalOnMissingBean({ JettyServerThreadPoolMetrics.class,
+ io.micrometer.core.instrument.binder.jetty.JettyServerThreadPoolMetrics.class,
+ JettyServerThreadPoolMetricsBinder.class })
public JettyServerThreadPoolMetricsBinder jettyServerThreadPoolMetricsBinder(MeterRegistry meterRegistry) {
return new JettyServerThreadPoolMetricsBinder(meterRegistry);
}
@Bean
- @ConditionalOnMissingBean({ JettyConnectionMetrics.class, JettyConnectionMetricsBinder.class })
+ @ConditionalOnMissingBean({ JettyConnectionMetrics.class,
+ io.micrometer.core.instrument.binder.jetty.JettyConnectionMetrics.class,
+ JettyConnectionMetricsBinder.class })
public JettyConnectionMetricsBinder jettyConnectionMetricsBinder(MeterRegistry meterRegistry) {
return new JettyConnectionMetricsBinder(meterRegistry);
}
@Bean
- @ConditionalOnMissingBean({ JettySslHandshakeMetrics.class, JettySslHandshakeMetricsBinder.class })
+ @ConditionalOnMissingBean({ JettySslHandshakeMetrics.class,
+ io.micrometer.core.instrument.binder.jetty.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 b5818258b8..18c213236f 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;
@@ -43,7 +43,8 @@ public class TomcatMetricsAutoConfiguration {
@Bean
@ConditionalOnBean(MeterRegistry.class)
- @ConditionalOnMissingBean({ TomcatMetrics.class, TomcatMetricsBinder.class })
+ @ConditionalOnMissingBean({ TomcatMetrics.class, io.micrometer.core.instrument.binder.tomcat.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 4b93645e72..e46f761b8b 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2021 the original author or authors.
+ * 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.
@@ -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 94da4bf4b5..a2df3d4446 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2021 the original author or authors.
+ * 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.
@@ -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 93761e2b66..245b5b3c9f 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2021 the original author or authors.
+ * 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.
@@ -16,11 +16,15 @@
package org.springframework.boot.actuate.autoconfigure.metrics;
-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 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 org.junit.jupiter.api.Test;
import org.springframework.boot.actuate.autoconfigure.metrics.test.MetricsRun;
@@ -55,34 +59,98 @@ 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")));
}
- private ContextConsumer assertMetricsBeans() {
- return (context) -> assertThat(context).hasSingleBean(JvmGcMetrics.class)
- .hasSingleBean(JvmHeapPressureMetrics.class).hasSingleBean(JvmMemoryMetrics.class)
- .hasSingleBean(JvmThreadMetrics.class).hasSingleBean(ClassLoaderMetrics.class);
+ @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);
+ }
+ };
}
@Configuration(proxyBeanMethods = false)
@@ -95,6 +163,16 @@ class JvmMetricsAutoConfigurationTests {
}
+ @Configuration(proxyBeanMethods = false)
+ 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 {
@@ -105,6 +183,16 @@ class JvmMetricsAutoConfigurationTests {
}
+ @Configuration(proxyBeanMethods = false)
+ 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 {
@@ -115,6 +203,16 @@ class JvmMetricsAutoConfigurationTests {
}
+ @Configuration(proxyBeanMethods = false)
+ 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 {
@@ -125,6 +223,16 @@ class JvmMetricsAutoConfigurationTests {
}
+ @Configuration(proxyBeanMethods = false)
+ 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 {
@@ -135,4 +243,14 @@ class JvmMetricsAutoConfigurationTests {
}
+ @Configuration(proxyBeanMethods = false)
+ 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 85695565e9..df82ff13f9 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * 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.
@@ -16,7 +16,7 @@
package org.springframework.boot.actuate.autoconfigure.metrics;
-import io.micrometer.core.instrument.binder.logging.Log4j2Metrics;
+import io.micrometer.binder.logging.Log4j2Metrics;
import org.apache.logging.log4j.LogManager;
import org.junit.jupiter.api.Test;
@@ -55,6 +55,17 @@ 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 {
@@ -65,4 +76,14 @@ class Log4J2MetricsWithLog4jLoggerContextAutoConfigurationTests {
}
+ @Configuration(proxyBeanMethods = false)
+ 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 2d5242dd80..87c99a8191 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * 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.
@@ -16,7 +16,7 @@
package org.springframework.boot.actuate.autoconfigure.metrics;
-import io.micrometer.core.instrument.binder.logging.Log4j2Metrics;
+import io.micrometer.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 caf3572f18..004613c209 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * 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.
@@ -16,7 +16,7 @@
package org.springframework.boot.actuate.autoconfigure.metrics;
-import io.micrometer.core.instrument.binder.logging.LogbackMetrics;
+import io.micrometer.binder.logging.LogbackMetrics;
import org.junit.jupiter.api.Test;
import org.springframework.boot.actuate.autoconfigure.metrics.test.MetricsRun;
@@ -49,6 +49,15 @@ 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 {
@@ -59,4 +68,14 @@ class LogbackMetricsAutoConfigurationTests {
}
+ @Configuration(proxyBeanMethods = false)
+ 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 7cb08ce22f..4790f8c00e 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * 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.
@@ -16,7 +16,7 @@
package org.springframework.boot.actuate.autoconfigure.metrics;
-import io.micrometer.core.instrument.binder.logging.LogbackMetrics;
+import io.micrometer.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 93f705df76..0fae3a1e8a 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2021 the original author or authors.
+ * 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.
@@ -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,6 +58,15 @@ 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));
@@ -70,6 +79,15 @@ 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));
@@ -82,6 +100,15 @@ 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));
@@ -125,6 +152,16 @@ class SystemMetricsAutoConfigurationTests {
}
+ @Configuration(proxyBeanMethods = false)
+ 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 {
@@ -135,6 +172,16 @@ class SystemMetricsAutoConfigurationTests {
}
+ @Configuration(proxyBeanMethods = false)
+ 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 {
@@ -145,6 +192,16 @@ class SystemMetricsAutoConfigurationTests {
}
+ @Configuration(proxyBeanMethods = false)
+ 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 7efe69360b..48e993f495 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2020 the original author or authors.
+ * 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.
@@ -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 54053c88f5..91e1d96fd9 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2021 the original author or authors.
+ * 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.
@@ -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,6 +85,17 @@ 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) -> {
@@ -144,6 +155,16 @@ class JerseyServerMetricsAutoConfigurationTests {
}
+ @Configuration(proxyBeanMethods = false)
+ static class CustomJerseyTagsProviderBackwardsCompatibleConfiguration {
+
+ @Bean
+ io.micrometer.core.instrument.binder.jersey.server.JerseyTagsProvider customJerseyTagsProvider() {
+ return new CustomJerseyTagsProviderBackwardsCompatible();
+ }
+
+ }
+
static class CustomJerseyTagsProvider implements JerseyTagsProvider {
@Override
@@ -158,4 +179,19 @@ class JerseyServerMetricsAutoConfigurationTests {
}
+ 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 2e92c944cd..ad7aba312b 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2021 the original author or authors.
+ * 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.
@@ -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.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 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 org.junit.jupiter.api.Test;
import org.springframework.boot.actuate.autoconfigure.metrics.test.MetricsRun;
@@ -93,7 +93,7 @@ class MongoMetricsAutoConfigurationTests {
@Test
void whenThereIsACustomMetricsCommandTagsProviderItIsUsed() {
- final MongoCommandTagsProvider customTagsProvider = mock(MongoCommandTagsProvider.class);
+ MongoCommandTagsProvider customTagsProvider = mock(MongoCommandTagsProvider.class);
this.contextRunner.with(MetricsRun.simple())
.withConfiguration(AutoConfigurations.of(MongoAutoConfiguration.class))
.withBean("customMongoCommandTagsProvider", MongoCommandTagsProvider.class, () -> customTagsProvider)
@@ -101,9 +101,27 @@ 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() {
- final MongoConnectionPoolTagsProvider customTagsProvider = mock(MongoConnectionPoolTagsProvider.class);
+ MongoConnectionPoolTagsProvider customTagsProvider = mock(MongoConnectionPoolTagsProvider.class);
this.contextRunner.with(MetricsRun.simple())
.withConfiguration(AutoConfigurations.of(MongoAutoConfiguration.class))
.withBean("customMongoConnectionPoolTagsProvider", MongoConnectionPoolTagsProvider.class,
@@ -112,6 +130,25 @@ 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())
@@ -176,26 +213,25 @@ class MongoMetricsAutoConfigurationTests {
}
private MongoClientSettings getActualMongoClientSettingsUsedToConstructClient(
- final AssertableApplicationContext context) {
- final MongoClientImpl mongoClient = (MongoClientImpl) context.getBean(MongoClient.class);
+ AssertableApplicationContext context) {
+ MongoClientImpl mongoClient = (MongoClientImpl) context.getBean(MongoClient.class);
return mongoClient.getSettings();
}
- private List getConnectionPoolListenersFromClient(
- final AssertableApplicationContext context) {
+ private List getConnectionPoolListenersFromClient(AssertableApplicationContext context) {
MongoClientSettings mongoClientSettings = getActualMongoClientSettingsUsedToConstructClient(context);
ConnectionPoolSettings connectionPoolSettings = mongoClientSettings.getConnectionPoolSettings();
return connectionPoolSettings.getConnectionPoolListeners();
}
private MongoCommandTagsProvider getMongoCommandTagsProviderUsedToConstructListener(
- final AssertableApplicationContext context) {
+ AssertableApplicationContext context) {
MongoMetricsCommandListener listener = context.getBean(MongoMetricsCommandListener.class);
return (MongoCommandTagsProvider) ReflectionTestUtils.getField(listener, "tagsProvider");
}
private MongoConnectionPoolTagsProvider getMongoConnectionPoolTagsProviderUsedToConstructListener(
- final AssertableApplicationContext context) {
+ 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 842c7a0f99..86f50f10b2 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2020 the original author or authors.
+ * 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.
@@ -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 8d377317b2..ee1a81cd5e 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2021 the original author or authors.
+ * 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.
@@ -16,9 +16,13 @@
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;
@@ -86,6 +90,28 @@ 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)
@@ -130,6 +156,26 @@ 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)
@@ -187,6 +233,28 @@ 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)
@@ -255,6 +323,27 @@ class JettyMetricsAutoConfigurationTests {
}
+ @Configuration(proxyBeanMethods = false)
+ static class CustomJettyServerThreadPoolMetrics {
+
+ @Bean
+ JettyServerThreadPoolMetrics customJettyServerThreadPoolMetrics() {
+ return new JettyServerThreadPoolMetrics(mock(ThreadPool.class), Tags.empty());
+ }
+
+ }
+
+ @Configuration(proxyBeanMethods = false)
+ 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 {
@@ -265,6 +354,27 @@ class JettyMetricsAutoConfigurationTests {
}
+ @Configuration(proxyBeanMethods = false)
+ static class CustomJettyConnectionMetrics {
+
+ @Bean
+ JettyConnectionMetrics customJettyConnectionMetrics(MeterRegistry meterRegistry) {
+ return new JettyConnectionMetrics(meterRegistry);
+ }
+
+ }
+
+ @Configuration(proxyBeanMethods = false)
+ 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 {
@@ -275,4 +385,25 @@ class JettyMetricsAutoConfigurationTests {
}
+ @Configuration(proxyBeanMethods = false)
+ static class CustomJettySslHandshakeMetrics {
+
+ @Bean
+ JettySslHandshakeMetrics customJettySslHandshakeMetrics(MeterRegistry meterRegistry) {
+ return new JettySslHandshakeMetrics(meterRegistry);
+ }
+
+ }
+
+ @Configuration(proxyBeanMethods = false)
+ 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 41716df7c4..3078045238 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2021 the original author or authors.
+ * 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.
@@ -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,6 +108,16 @@ 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);
}
@@ -164,6 +174,16 @@ class TomcatMetricsAutoConfigurationTests {
}
+ @Configuration(proxyBeanMethods = false)
+ 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 3ef631eb02..b51d56480a 100644
--- a/spring-boot-project/spring-boot-actuator/build.gradle
+++ b/spring-boot-project/spring-boot-actuator/build.gradle
@@ -23,6 +23,7 @@ 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 8e69188a1e..71eb38bc42 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2021 the original author or authors.
+ * 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.
@@ -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 b848b8f50c..af666f4e9b 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * 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.
@@ -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 8688fe72a7..f280cbe997 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2020 the original author or authors.
+ * 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.
@@ -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 70c61c8c2b..5e91fb0f1e 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2021 the original author or authors.
+ * 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.
@@ -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/cache/RedisCacheMetrics.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/RedisCacheMetrics.java
index 6b1ec21721..dd18638f3e 100644
--- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/RedisCacheMetrics.java
+++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/cache/RedisCacheMetrics.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2021 the original author or authors.
+ * 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.
@@ -18,11 +18,11 @@ package org.springframework.boot.actuate.metrics.cache;
import java.util.concurrent.TimeUnit;
+import io.micrometer.binder.cache.CacheMeterBinder;
import io.micrometer.core.instrument.FunctionCounter;
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.Tag;
import io.micrometer.core.instrument.TimeGauge;
-import io.micrometer.core.instrument.binder.cache.CacheMeterBinder;
import org.springframework.data.redis.cache.RedisCache;
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 d6518b2716..b5eba5f8a1 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2021 the original author or authors.
+ * 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.
@@ -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 17e7a67b7a..662dd2ad23 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2021 the original author or authors.
+ * 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.
@@ -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 af5b2b0a0d..4801f05ebd 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2021 the original author or authors.
+ * 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.
@@ -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 a60187be16..f590d24ffe 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2021 the original author or authors.
+ * 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.
@@ -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 0932218080..1de4181eda 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2021 the original author or authors.
+ * 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.
@@ -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 d3ad3b7f23..583cae0258 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * 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.
@@ -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 187d5c2f03..d4246cf340 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * 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.
@@ -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 c67750074a..689c581bfa 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * 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.
@@ -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 08b9a08f59..d5b57e21a4 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2020 the original author or authors.
+ * 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.
@@ -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 2e1b97ad95..8d9a8f0015 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2019 the original author or authors.
+ * 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.
@@ -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 64bacc1ec6..6d3affe3e2 100644
--- a/spring-boot-project/spring-boot-dependencies/build.gradle
+++ b/spring-boot-project/spring-boot-dependencies/build.gradle
@@ -1242,7 +1242,7 @@ bom {
]
}
}
- library("Micrometer", "1.9.0-M3") {
+ library("Micrometer", "1.9.0-SNAPSHOT") {
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 e5691af8c5..13d9d7fb6f 100644
--- a/spring-boot-project/spring-boot-docs/build.gradle
+++ b/spring-boot-project/spring-boot-docs/build.gradle
@@ -77,6 +77,7 @@ 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 587446e182..17b85d18f0 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2021 the original author or authors.
+ * 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.
@@ -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 066a9ebd0d..c236945c7a 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2021 the original author or authors.
+ * 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.
@@ -16,7 +16,7 @@
package org.springframework.boot.docs.actuator.metrics.supported.mongodb.command;
-import io.micrometer.core.instrument.binder.mongodb.MongoCommandTagsProvider;
+import io.micrometer.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 ece9565a5a..fa1dee5db1 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2021 the original author or authors.
+ * 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.
@@ -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 72bcadf507..0d6954fba2 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
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2021 the original author or authors.
+ * 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.
@@ -16,7 +16,7 @@
package org.springframework.boot.docs.actuator.metrics.supported.mongodb.connectionpool;
-import io.micrometer.core.instrument.binder.mongodb.MongoConnectionPoolTagsProvider;
+import io.micrometer.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/registeringcustom/MyMeterBinderConfiguration.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/actuator/metrics/registeringcustom/MyMeterBinderConfiguration.kt
index 3af700261b..13a975b2ac 100644
--- a/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/actuator/metrics/registeringcustom/MyMeterBinderConfiguration.kt
+++ b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/actuator/metrics/registeringcustom/MyMeterBinderConfiguration.kt
@@ -29,4 +29,4 @@ class MyMeterBinderConfiguration {
}
}
-}
\ 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/CustomCommandTagsProvider.kt b/spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/actuator/metrics/supported/mongodb/command/CustomCommandTagsProvider.kt
index 7c49e6e6c4..34ce16d9ff 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 f412eefcad..796ad6dad5 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.core.instrument.binder.mongodb.MongoCommandTagsProvider
+import io.micrometer.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 b84dcc695c..f05a1fdf56 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 49a40e46da..260b889cbb 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.core.instrument.binder.mongodb.MongoConnectionPoolTagsProvider
+import io.micrometer.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 4c4d4c9089..fc3ad62564 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,4 +8,5 @@ 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")
}