Align with latest changes in Micrometer 1.9 snapshots

See gh-30605
pull/29812/head
Andy Wilkinson 3 years ago
parent 48f8021d88
commit 6580f6c742

@ -48,7 +48,6 @@ dependencies {
optional("io.dropwizard.metrics:metrics-jmx")
optional("io.lettuce:lettuce-core")
optional("io.micrometer:micrometer-core")
optional("io.micrometer:micrometer-binders")
optional("io.micrometer:micrometer-registry-appoptics")
optional("io.micrometer:micrometer-registry-atlas") {
exclude group: "javax.inject", module: "javax.inject"

@ -16,12 +16,12 @@
package org.springframework.boot.actuate.autoconfigure.metrics;
import io.micrometer.binder.jvm.ClassLoaderMetrics;
import io.micrometer.binder.jvm.JvmGcMetrics;
import io.micrometer.binder.jvm.JvmHeapPressureMetrics;
import io.micrometer.binder.jvm.JvmMemoryMetrics;
import io.micrometer.binder.jvm.JvmThreadMetrics;
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.binder.jvm.ClassLoaderMetrics;
import io.micrometer.core.instrument.binder.jvm.JvmGcMetrics;
import io.micrometer.core.instrument.binder.jvm.JvmHeapPressureMetrics;
import io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics;
import io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@ -39,39 +39,34 @@ import org.springframework.context.annotation.Bean;
@AutoConfiguration(after = { MetricsAutoConfiguration.class, CompositeMeterRegistryAutoConfiguration.class })
@ConditionalOnClass(MeterRegistry.class)
@ConditionalOnBean(MeterRegistry.class)
@SuppressWarnings("deprecation")
public class JvmMetricsAutoConfiguration {
@Bean
@ConditionalOnMissingBean({ JvmGcMetrics.class, io.micrometer.core.instrument.binder.jvm.JvmGcMetrics.class })
@ConditionalOnMissingBean
public JvmGcMetrics jvmGcMetrics() {
return new JvmGcMetrics();
}
@Bean
@ConditionalOnMissingBean({ JvmHeapPressureMetrics.class,
io.micrometer.core.instrument.binder.jvm.JvmHeapPressureMetrics.class })
@ConditionalOnMissingBean
public JvmHeapPressureMetrics jvmHeapPressureMetrics() {
return new JvmHeapPressureMetrics();
}
@Bean
@ConditionalOnMissingBean({ JvmMemoryMetrics.class,
io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics.class })
@ConditionalOnMissingBean
public JvmMemoryMetrics jvmMemoryMetrics() {
return new JvmMemoryMetrics();
}
@Bean
@ConditionalOnMissingBean({ JvmThreadMetrics.class,
io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics.class })
@ConditionalOnMissingBean
public JvmThreadMetrics jvmThreadMetrics() {
return new JvmThreadMetrics();
}
@Bean
@ConditionalOnMissingBean({ ClassLoaderMetrics.class,
io.micrometer.core.instrument.binder.jvm.ClassLoaderMetrics.class })
@ConditionalOnMissingBean
public ClassLoaderMetrics classLoaderMetrics() {
return new ClassLoaderMetrics();
}

@ -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;

@ -16,8 +16,8 @@
package org.springframework.boot.actuate.autoconfigure.metrics;
import io.micrometer.binder.logging.Log4j2Metrics;
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.binder.logging.Log4j2Metrics;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.spi.LoggerContext;
@ -44,11 +44,10 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
name = "org.apache.logging.log4j.core.LoggerContext")
@ConditionalOnBean(MeterRegistry.class)
@Conditional(Log4JCoreLoggerContextCondition.class)
@SuppressWarnings("deprecation")
public class Log4J2MetricsAutoConfiguration {
@Bean
@ConditionalOnMissingBean({ Log4j2Metrics.class, io.micrometer.core.instrument.binder.logging.Log4j2Metrics.class })
@ConditionalOnMissingBean
public Log4j2Metrics log4j2Metrics() {
return new Log4j2Metrics();
}

@ -17,8 +17,8 @@
package org.springframework.boot.actuate.autoconfigure.metrics;
import ch.qos.logback.classic.LoggerContext;
import io.micrometer.binder.logging.LogbackMetrics;
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.binder.logging.LogbackMetrics;
import org.slf4j.ILoggerFactory;
import org.slf4j.LoggerFactory;
@ -46,12 +46,10 @@ import org.springframework.core.type.AnnotatedTypeMetadata;
@ConditionalOnClass({ MeterRegistry.class, LoggerContext.class, LoggerFactory.class })
@ConditionalOnBean(MeterRegistry.class)
@Conditional(LogbackLoggingCondition.class)
@SuppressWarnings("deprecation")
public class LogbackMetricsAutoConfiguration {
@Bean
@ConditionalOnMissingBean({ LogbackMetrics.class,
io.micrometer.core.instrument.binder.logging.LogbackMetrics.class })
@ConditionalOnMissingBean
public LogbackMetrics logbackMetrics() {
return new LogbackMetrics();
}

@ -19,11 +19,11 @@ package org.springframework.boot.actuate.autoconfigure.metrics;
import java.io.File;
import java.util.List;
import io.micrometer.binder.system.FileDescriptorMetrics;
import io.micrometer.binder.system.ProcessorMetrics;
import io.micrometer.binder.system.UptimeMetrics;
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.Tags;
import io.micrometer.core.instrument.binder.system.FileDescriptorMetrics;
import io.micrometer.core.instrument.binder.system.ProcessorMetrics;
import io.micrometer.core.instrument.binder.system.UptimeMetrics;
import org.springframework.boot.actuate.metrics.system.DiskSpaceMetricsBinder;
import org.springframework.boot.autoconfigure.AutoConfiguration;
@ -45,25 +45,22 @@ import org.springframework.context.annotation.Bean;
@ConditionalOnClass(MeterRegistry.class)
@ConditionalOnBean(MeterRegistry.class)
@EnableConfigurationProperties(MetricsProperties.class)
@SuppressWarnings("deprecation")
public class SystemMetricsAutoConfiguration {
@Bean
@ConditionalOnMissingBean({ UptimeMetrics.class, io.micrometer.core.instrument.binder.system.UptimeMetrics.class })
@ConditionalOnMissingBean
public UptimeMetrics uptimeMetrics() {
return new UptimeMetrics();
}
@Bean
@ConditionalOnMissingBean({ ProcessorMetrics.class,
io.micrometer.core.instrument.binder.system.ProcessorMetrics.class })
@ConditionalOnMissingBean
public ProcessorMetrics processorMetrics() {
return new ProcessorMetrics();
}
@Bean
@ConditionalOnMissingBean({ FileDescriptorMetrics.class,
io.micrometer.core.instrument.binder.system.FileDescriptorMetrics.class })
@ConditionalOnMissingBean
public FileDescriptorMetrics fileDescriptorMetrics() {
return new FileDescriptorMetrics();
}

@ -1,44 +0,0 @@
/*
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.actuate.autoconfigure.metrics.jersey;
import io.micrometer.binder.jersey.server.DefaultJerseyTagsProvider;
import io.micrometer.binder.jersey.server.JerseyTagsProvider;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
/**
* Configurations, imported from {@link JerseyServerMetricsAutoConfiguration}.
*
* @author Moritz Halbritter
*/
@SuppressWarnings("deprecation")
abstract class JerseyConfigurations {
static class JerseyTagsProviderConfiguration {
@Bean
@ConditionalOnMissingBean({ JerseyTagsProvider.class,
io.micrometer.core.instrument.binder.jersey.server.JerseyTagsProvider.class })
DefaultJerseyTagsProvider jerseyTagsProvider() {
return new DefaultJerseyTagsProvider();
}
}
}

@ -19,10 +19,11 @@ package org.springframework.boot.actuate.autoconfigure.metrics.jersey;
import java.lang.annotation.Annotation;
import java.lang.reflect.AnnotatedElement;
import io.micrometer.binder.jersey.server.AnnotationFinder;
import io.micrometer.binder.jersey.server.JerseyTagsProvider;
import io.micrometer.binder.jersey.server.MetricsApplicationEventListener;
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.binder.jersey.server.AnnotationFinder;
import io.micrometer.core.instrument.binder.jersey.server.DefaultJerseyTagsProvider;
import io.micrometer.core.instrument.binder.jersey.server.JerseyTagsProvider;
import io.micrometer.core.instrument.binder.jersey.server.MetricsApplicationEventListener;
import io.micrometer.core.instrument.config.MeterFilter;
import org.glassfish.jersey.server.ResourceConfig;
@ -31,16 +32,15 @@ import org.springframework.boot.actuate.autoconfigure.metrics.MetricsProperties;
import org.springframework.boot.actuate.autoconfigure.metrics.MetricsProperties.Web.Server;
import org.springframework.boot.actuate.autoconfigure.metrics.OnlyOnceLoggingDenyMeterFilter;
import org.springframework.boot.actuate.autoconfigure.metrics.export.simple.SimpleMetricsExportAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.metrics.jersey.JerseyConfigurations.JerseyTagsProviderConfiguration;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.autoconfigure.jersey.ResourceConfigCustomizer;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.core.annotation.Order;
@ -57,8 +57,6 @@ import org.springframework.core.annotation.Order;
@ConditionalOnClass({ ResourceConfig.class, MetricsApplicationEventListener.class })
@ConditionalOnBean({ MeterRegistry.class, ResourceConfig.class })
@EnableConfigurationProperties(MetricsProperties.class)
@Import(JerseyTagsProviderConfiguration.class)
@SuppressWarnings("deprecation")
public class JerseyServerMetricsAutoConfiguration {
private final MetricsProperties properties;
@ -68,7 +66,12 @@ public class JerseyServerMetricsAutoConfiguration {
}
@Bean
@ConditionalOnBean(JerseyTagsProvider.class)
@ConditionalOnMissingBean(JerseyTagsProvider.class)
public DefaultJerseyTagsProvider jerseyTagsProvider() {
return new DefaultJerseyTagsProvider();
}
@Bean
public ResourceConfigCustomizer jerseyServerMetricsResourceConfigCustomizer(MeterRegistry meterRegistry,
JerseyTagsProvider tagsProvider) {
Server server = this.properties.getWeb().getServer();
@ -77,19 +80,6 @@ public class JerseyServerMetricsAutoConfiguration {
server.getRequest().getAutotime().isEnabled(), new AnnotationUtilsAnnotationFinder()));
}
@Bean
@ConditionalOnBean(io.micrometer.core.instrument.binder.jersey.server.JerseyTagsProvider.class)
public ResourceConfigCustomizer jerseyServerMetricsResourceConfigCustomizerBackwardsCompatible(
MeterRegistry meterRegistry,
io.micrometer.core.instrument.binder.jersey.server.JerseyTagsProvider tagsProvider) {
Server server = this.properties.getWeb().getServer();
return (config) -> config.register(
new io.micrometer.core.instrument.binder.jersey.server.MetricsApplicationEventListener(meterRegistry,
tagsProvider, server.getRequest().getMetricName(),
server.getRequest().getAutotime().isEnabled(),
new AnnotationUtilsAnnotationFinderBackwardsCompatible()));
}
@Bean
@Order(0)
public MeterFilter jerseyMetricsUriTagFilter() {
@ -112,18 +102,4 @@ public class JerseyServerMetricsAutoConfiguration {
}
/**
* An {@link AnnotationFinder} (for backwards compatability) that uses
* {@link AnnotationUtils}.
*/
private static class AnnotationUtilsAnnotationFinderBackwardsCompatible
implements io.micrometer.core.instrument.binder.jersey.server.AnnotationFinder {
@Override
public <A extends Annotation> A findAnnotation(AnnotatedElement annotatedElement, Class<A> annotationType) {
return AnnotationUtils.findAnnotation(annotatedElement, annotationType);
}
}
}

@ -1,117 +0,0 @@
/*
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.actuate.autoconfigure.metrics.mongo;
import io.micrometer.binder.mongodb.DefaultMongoCommandTagsProvider;
import io.micrometer.binder.mongodb.DefaultMongoConnectionPoolTagsProvider;
import io.micrometer.binder.mongodb.MongoCommandTagsProvider;
import io.micrometer.binder.mongodb.MongoMetricsCommandListener;
import io.micrometer.core.instrument.MeterRegistry;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
/**
* Configurations, imported from {@link MongoMetricsAutoConfiguration}.
*
* @author Moritz Halbritter
*/
@SuppressWarnings("deprecation")
abstract class MongoConfigurations {
@Configuration(proxyBeanMethods = false)
static class MongoCommandTagsProviderConfiguration {
@Bean
@ConditionalOnMissingBean({ MongoCommandTagsProvider.class,
io.micrometer.core.instrument.binder.mongodb.MongoCommandTagsProvider.class })
MongoCommandTagsProvider mongoCommandTagsProvider() {
return new DefaultMongoCommandTagsProvider();
}
}
@Configuration(proxyBeanMethods = false)
@Import(MongoCommandTagsProviderConfiguration.class)
static class MongoMetricsCommandListenerConfiguration {
@Bean
@ConditionalOnMissingBean({ MongoMetricsCommandListener.class,
io.micrometer.core.instrument.binder.mongodb.MongoMetricsCommandListener.class })
@ConditionalOnBean(MongoCommandTagsProvider.class)
MongoMetricsCommandListener mongoMetricsCommandListener(MeterRegistry meterRegistry,
MongoCommandTagsProvider mongoCommandTagsProvider) {
return new MongoMetricsCommandListener(meterRegistry, mongoCommandTagsProvider);
}
@Bean
@ConditionalOnMissingBean({ MongoMetricsCommandListener.class,
io.micrometer.core.instrument.binder.mongodb.MongoMetricsCommandListener.class })
@ConditionalOnBean(io.micrometer.core.instrument.binder.mongodb.MongoCommandTagsProvider.class)
io.micrometer.core.instrument.binder.mongodb.MongoMetricsCommandListener mongoMetricsCommandListenerBackwardsCompatible(
MeterRegistry meterRegistry,
io.micrometer.core.instrument.binder.mongodb.MongoCommandTagsProvider mongoCommandTagsProvider) {
return new io.micrometer.core.instrument.binder.mongodb.MongoMetricsCommandListener(meterRegistry,
mongoCommandTagsProvider);
}
}
@Configuration(proxyBeanMethods = false)
static class MongoConnectionPoolTagsProviderConfiguration {
@Bean
@ConditionalOnMissingBean({ io.micrometer.binder.mongodb.MongoConnectionPoolTagsProvider.class,
io.micrometer.core.instrument.binder.mongodb.MongoConnectionPoolTagsProvider.class })
io.micrometer.binder.mongodb.MongoConnectionPoolTagsProvider mongoConnectionPoolTagsProvider() {
return new DefaultMongoConnectionPoolTagsProvider();
}
}
@Configuration(proxyBeanMethods = false)
@Import(MongoConnectionPoolTagsProviderConfiguration.class)
static class MongoMetricsConnectionPoolListenerConfiguration {
@Bean
@ConditionalOnMissingBean({ io.micrometer.binder.mongodb.MongoMetricsConnectionPoolListener.class,
io.micrometer.core.instrument.binder.mongodb.MongoMetricsConnectionPoolListener.class })
@ConditionalOnBean(io.micrometer.binder.mongodb.MongoConnectionPoolTagsProvider.class)
io.micrometer.binder.mongodb.MongoMetricsConnectionPoolListener mongoMetricsConnectionPoolListener(
MeterRegistry meterRegistry,
io.micrometer.binder.mongodb.MongoConnectionPoolTagsProvider mongoConnectionPoolTagsProvider) {
return new io.micrometer.binder.mongodb.MongoMetricsConnectionPoolListener(meterRegistry,
mongoConnectionPoolTagsProvider);
}
@Bean
@ConditionalOnMissingBean({ io.micrometer.binder.mongodb.MongoMetricsConnectionPoolListener.class,
io.micrometer.core.instrument.binder.mongodb.MongoMetricsConnectionPoolListener.class })
@ConditionalOnBean(io.micrometer.core.instrument.binder.mongodb.MongoConnectionPoolTagsProvider.class)
io.micrometer.core.instrument.binder.mongodb.MongoMetricsConnectionPoolListener mongoMetricsConnectionPoolListenerBackwardsCompatible(
MeterRegistry meterRegistry,
io.micrometer.core.instrument.binder.mongodb.MongoConnectionPoolTagsProvider mongoConnectionPoolTagsProvider) {
return new io.micrometer.core.instrument.binder.mongodb.MongoMetricsConnectionPoolListener(meterRegistry,
mongoConnectionPoolTagsProvider);
}
}
}

@ -17,83 +17,86 @@
package org.springframework.boot.actuate.autoconfigure.metrics.mongo;
import com.mongodb.MongoClientSettings;
import io.micrometer.binder.mongodb.MongoMetricsCommandListener;
import io.micrometer.binder.mongodb.MongoMetricsConnectionPoolListener;
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.binder.mongodb.DefaultMongoCommandTagsProvider;
import io.micrometer.core.instrument.binder.mongodb.DefaultMongoConnectionPoolTagsProvider;
import io.micrometer.core.instrument.binder.mongodb.MongoCommandTagsProvider;
import io.micrometer.core.instrument.binder.mongodb.MongoConnectionPoolTagsProvider;
import io.micrometer.core.instrument.binder.mongodb.MongoMetricsCommandListener;
import io.micrometer.core.instrument.binder.mongodb.MongoMetricsConnectionPoolListener;
import org.springframework.boot.actuate.autoconfigure.metrics.CompositeMeterRegistryAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration;
import org.springframework.boot.actuate.autoconfigure.metrics.mongo.MongoConfigurations.MongoMetricsCommandListenerConfiguration;
import org.springframework.boot.actuate.autoconfigure.metrics.mongo.MongoConfigurations.MongoMetricsConnectionPoolListenerConfiguration;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
import org.springframework.boot.autoconfigure.mongo.MongoClientSettingsBuilderCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
/**
* {@link EnableAutoConfiguration Auto-configuration} for Mongo metrics.
*
* @author Chris Bono
* @author Jonatan Ivanov
* @author Moritz Halbritter
* @since 2.5.0
*/
@AutoConfiguration(before = MongoAutoConfiguration.class,
after = { MetricsAutoConfiguration.class, CompositeMeterRegistryAutoConfiguration.class })
@ConditionalOnClass(MongoClientSettings.class)
@ConditionalOnBean(MeterRegistry.class)
@SuppressWarnings("deprecation")
public class MongoMetricsAutoConfiguration {
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(MongoMetricsCommandListener.class)
@ConditionalOnProperty(name = "management.metrics.mongo.command.enabled", havingValue = "true",
matchIfMissing = true)
@Import(MongoMetricsCommandListenerConfiguration.class)
static class MongoCommandMetricsConfiguration {
@Bean
@ConditionalOnBean(MongoMetricsCommandListener.class)
MongoClientSettingsBuilderCustomizer mongoMetricsCommandListenerClientSettingsBuilderCustomizer(
MongoMetricsCommandListener mongoMetricsCommandListener) {
return (clientSettingsBuilder) -> clientSettingsBuilder.addCommandListener(mongoMetricsCommandListener);
@ConditionalOnMissingBean
MongoMetricsCommandListener mongoMetricsCommandListener(MeterRegistry meterRegistry,
MongoCommandTagsProvider mongoCommandTagsProvider) {
return new MongoMetricsCommandListener(meterRegistry, mongoCommandTagsProvider);
}
@Bean
@ConditionalOnBean(io.micrometer.core.instrument.binder.mongodb.MongoMetricsCommandListener.class)
MongoClientSettingsBuilderCustomizer mongoMetricsCommandListenerClientSettingsBuilderCustomizerBackwardsCompatible(
io.micrometer.core.instrument.binder.mongodb.MongoMetricsCommandListener mongoMetricsCommandListener) {
@ConditionalOnMissingBean
MongoCommandTagsProvider mongoCommandTagsProvider() {
return new DefaultMongoCommandTagsProvider();
}
@Bean
MongoClientSettingsBuilderCustomizer mongoMetricsCommandListenerClientSettingsBuilderCustomizer(
MongoMetricsCommandListener mongoMetricsCommandListener) {
return (clientSettingsBuilder) -> clientSettingsBuilder.addCommandListener(mongoMetricsCommandListener);
}
}
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(MongoMetricsConnectionPoolListener.class)
@ConditionalOnProperty(name = "management.metrics.mongo.connectionpool.enabled", havingValue = "true",
matchIfMissing = true)
@Import(MongoMetricsConnectionPoolListenerConfiguration.class)
static class MongoConnectionPoolMetricsConfiguration {
@Bean
@ConditionalOnBean(MongoMetricsConnectionPoolListener.class)
MongoClientSettingsBuilderCustomizer mongoMetricsConnectionPoolListenerClientSettingsBuilderCustomizer(
MongoMetricsConnectionPoolListener mongoMetricsConnectionPoolListener) {
return (clientSettingsBuilder) -> clientSettingsBuilder
.applyToConnectionPoolSettings((connectionPoolSettingsBuilder) -> connectionPoolSettingsBuilder
.addConnectionPoolListener(mongoMetricsConnectionPoolListener));
@ConditionalOnMissingBean
MongoMetricsConnectionPoolListener mongoMetricsConnectionPoolListener(MeterRegistry meterRegistry,
MongoConnectionPoolTagsProvider mongoConnectionPoolTagsProvider) {
return new MongoMetricsConnectionPoolListener(meterRegistry, mongoConnectionPoolTagsProvider);
}
@Bean
@ConditionalOnBean(io.micrometer.core.instrument.binder.mongodb.MongoMetricsConnectionPoolListener.class)
MongoClientSettingsBuilderCustomizer mongoMetricsConnectionPoolListenerClientSettingsBuilderCustomizerBackwardsCompatible(
io.micrometer.core.instrument.binder.mongodb.MongoMetricsConnectionPoolListener mongoMetricsConnectionPoolListener) {
@ConditionalOnMissingBean
MongoConnectionPoolTagsProvider mongoConnectionPoolTagsProvider() {
return new DefaultMongoConnectionPoolTagsProvider();
}
@Bean
MongoClientSettingsBuilderCustomizer mongoMetricsConnectionPoolListenerClientSettingsBuilderCustomizer(
MongoMetricsConnectionPoolListener mongoMetricsConnectionPoolListener) {
return (clientSettingsBuilder) -> clientSettingsBuilder
.applyToConnectionPoolSettings((connectionPoolSettingsBuilder) -> connectionPoolSettingsBuilder
.addConnectionPoolListener(mongoMetricsConnectionPoolListener));

@ -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;

@ -16,10 +16,10 @@
package org.springframework.boot.actuate.autoconfigure.metrics.web.jetty;
import io.micrometer.binder.jetty.JettyConnectionMetrics;
import io.micrometer.binder.jetty.JettyServerThreadPoolMetrics;
import io.micrometer.binder.jetty.JettySslHandshakeMetrics;
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.binder.jetty.JettyConnectionMetrics;
import io.micrometer.core.instrument.binder.jetty.JettyServerThreadPoolMetrics;
import io.micrometer.core.instrument.binder.jetty.JettySslHandshakeMetrics;
import org.eclipse.jetty.server.Server;
import org.springframework.boot.actuate.autoconfigure.metrics.CompositeMeterRegistryAutoConfiguration;
@ -46,29 +46,22 @@ import org.springframework.context.annotation.Bean;
@ConditionalOnWebApplication
@ConditionalOnClass({ JettyServerThreadPoolMetrics.class, Server.class })
@ConditionalOnBean(MeterRegistry.class)
@SuppressWarnings("deprecation")
public class JettyMetricsAutoConfiguration {
@Bean
@ConditionalOnMissingBean({ JettyServerThreadPoolMetrics.class,
io.micrometer.core.instrument.binder.jetty.JettyServerThreadPoolMetrics.class,
JettyServerThreadPoolMetricsBinder.class })
@ConditionalOnMissingBean({ JettyServerThreadPoolMetrics.class, JettyServerThreadPoolMetricsBinder.class })
public JettyServerThreadPoolMetricsBinder jettyServerThreadPoolMetricsBinder(MeterRegistry meterRegistry) {
return new JettyServerThreadPoolMetricsBinder(meterRegistry);
}
@Bean
@ConditionalOnMissingBean({ JettyConnectionMetrics.class,
io.micrometer.core.instrument.binder.jetty.JettyConnectionMetrics.class,
JettyConnectionMetricsBinder.class })
@ConditionalOnMissingBean({ JettyConnectionMetrics.class, JettyConnectionMetricsBinder.class })
public JettyConnectionMetricsBinder jettyConnectionMetricsBinder(MeterRegistry meterRegistry) {
return new JettyConnectionMetricsBinder(meterRegistry);
}
@Bean
@ConditionalOnMissingBean({ JettySslHandshakeMetrics.class,
io.micrometer.core.instrument.binder.jetty.JettySslHandshakeMetrics.class,
JettySslHandshakeMetricsBinder.class })
@ConditionalOnMissingBean({ JettySslHandshakeMetrics.class, JettySslHandshakeMetricsBinder.class })
@ConditionalOnProperty(name = "server.ssl.enabled", havingValue = "true")
public JettySslHandshakeMetricsBinder jettySslHandshakeMetricsBinder(MeterRegistry meterRegistry) {
return new JettySslHandshakeMetricsBinder(meterRegistry);

@ -16,8 +16,8 @@
package org.springframework.boot.actuate.autoconfigure.metrics.web.tomcat;
import io.micrometer.binder.tomcat.TomcatMetrics;
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.binder.tomcat.TomcatMetrics;
import org.apache.catalina.Manager;
import org.springframework.boot.actuate.autoconfigure.metrics.CompositeMeterRegistryAutoConfiguration;
@ -39,13 +39,11 @@ import org.springframework.context.annotation.Bean;
@AutoConfiguration(after = CompositeMeterRegistryAutoConfiguration.class)
@ConditionalOnWebApplication
@ConditionalOnClass({ TomcatMetrics.class, Manager.class })
@SuppressWarnings("deprecation")
public class TomcatMetricsAutoConfiguration {
@Bean
@ConditionalOnBean(MeterRegistry.class)
@ConditionalOnMissingBean({ TomcatMetrics.class, io.micrometer.core.instrument.binder.tomcat.TomcatMetrics.class,
TomcatMetricsBinder.class })
@ConditionalOnMissingBean({ TomcatMetrics.class, TomcatMetricsBinder.class })
public TomcatMetricsBinder tomcatMetricsBinder(MeterRegistry meterRegistry) {
return new TomcatMetricsBinder(meterRegistry);
}

@ -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;

@ -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;

@ -16,15 +16,11 @@
package org.springframework.boot.actuate.autoconfigure.metrics;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import io.micrometer.binder.jvm.ClassLoaderMetrics;
import io.micrometer.binder.jvm.JvmGcMetrics;
import io.micrometer.binder.jvm.JvmHeapPressureMetrics;
import io.micrometer.binder.jvm.JvmMemoryMetrics;
import io.micrometer.binder.jvm.JvmThreadMetrics;
import io.micrometer.core.instrument.binder.jvm.ClassLoaderMetrics;
import io.micrometer.core.instrument.binder.jvm.JvmGcMetrics;
import io.micrometer.core.instrument.binder.jvm.JvmHeapPressureMetrics;
import io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics;
import io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics;
import org.junit.jupiter.api.Test;
import org.springframework.boot.actuate.autoconfigure.metrics.test.MetricsRun;
@ -59,98 +55,34 @@ class JvmMetricsAutoConfigurationTests {
.run(assertMetricsBeans().andThen((context) -> assertThat(context).hasBean("customJvmGcMetrics")));
}
@Test
@Deprecated
void allowsCustomJvmGcMetricsToBeUsedBackwardsCompatible() {
this.contextRunner.withUserConfiguration(CustomJvmGcMetricsBackwardsCompatibleConfiguration.class)
.run(assertMetricsBeans(JvmGcMetrics.class).andThen((context) -> {
assertThat(context).hasBean("customJvmGcMetrics");
assertThat(context).doesNotHaveBean(JvmGcMetrics.class);
assertThat(context).hasSingleBean(io.micrometer.core.instrument.binder.jvm.JvmGcMetrics.class);
}));
}
@Test
void allowsCustomJvmHeapPressureMetricsToBeUsed() {
this.contextRunner.withUserConfiguration(CustomJvmHeapPressureMetricsConfiguration.class).run(
assertMetricsBeans().andThen((context) -> assertThat(context).hasBean("customJvmHeapPressureMetrics")));
}
@Test
@Deprecated
void allowsCustomJvmHeapPressureMetricsToBeUsedBackwardsCompatible() {
this.contextRunner.withUserConfiguration(CustomJvmHeapPressureMetricsBackwardsCompatibleConfiguration.class)
.run(assertMetricsBeans(JvmHeapPressureMetrics.class).andThen((context) -> {
assertThat(context).hasBean("customJvmHeapPressureMetrics");
assertThat(context).doesNotHaveBean(JvmHeapPressureMetrics.class);
assertThat(context)
.hasSingleBean(io.micrometer.core.instrument.binder.jvm.JvmHeapPressureMetrics.class);
}));
}
@Test
void allowsCustomJvmMemoryMetricsToBeUsed() {
this.contextRunner.withUserConfiguration(CustomJvmMemoryMetricsConfiguration.class)
.run(assertMetricsBeans().andThen((context) -> assertThat(context).hasBean("customJvmMemoryMetrics")));
}
@Test
@Deprecated
void allowsCustomJvmMemoryMetricsToBeUsedBackwardsCompatible() {
this.contextRunner.withUserConfiguration(CustomJvmMemoryMetricsBackwardsCompatibleConfiguration.class)
.run(assertMetricsBeans(JvmMemoryMetrics.class).andThen((context) -> {
assertThat(context).hasBean("customJvmMemoryMetrics");
assertThat(context).doesNotHaveBean(JvmMemoryMetrics.class);
assertThat(context).hasSingleBean(io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics.class);
}));
}
@Test
void allowsCustomJvmThreadMetricsToBeUsed() {
this.contextRunner.withUserConfiguration(CustomJvmThreadMetricsConfiguration.class)
.run(assertMetricsBeans().andThen((context) -> assertThat(context).hasBean("customJvmThreadMetrics")));
}
@Test
@Deprecated
void allowsCustomJvmThreadMetricsToBeUsedBackwardsCompatible() {
this.contextRunner.withUserConfiguration(CustomJvmThreadMetricsBackwardsCompatibleConfiguration.class)
.run(assertMetricsBeans(JvmThreadMetrics.class).andThen((context) -> {
assertThat(context).hasBean("customJvmThreadMetrics");
assertThat(context).doesNotHaveBean(JvmThreadMetrics.class);
assertThat(context).hasSingleBean(io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics.class);
}));
}
@Test
void allowsCustomClassLoaderMetricsToBeUsed() {
this.contextRunner.withUserConfiguration(CustomClassLoaderMetricsConfiguration.class).run(
assertMetricsBeans().andThen((context) -> assertThat(context).hasBean("customClassLoaderMetrics")));
}
@Test
@Deprecated
void allowsCustomClassLoaderMetricsToBeUsedBackwardsCompatible() {
this.contextRunner.withUserConfiguration(CustomClassLoaderMetricsBackwardsCompatibleConfiguration.class)
.run(assertMetricsBeans(ClassLoaderMetrics.class).andThen((context) -> {
assertThat(context).hasBean("customClassLoaderMetrics");
assertThat(context).doesNotHaveBean(ClassLoaderMetrics.class);
assertThat(context)
.hasSingleBean(io.micrometer.core.instrument.binder.jvm.ClassLoaderMetrics.class);
}));
}
private ContextConsumer<AssertableApplicationContext> assertMetricsBeans(Class<?>... excludes) {
Set<Class<?>> beans = new HashSet<>(Arrays.asList(JvmGcMetrics.class, JvmHeapPressureMetrics.class,
JvmMemoryMetrics.class, JvmThreadMetrics.class, ClassLoaderMetrics.class));
for (Class<?> exclude : excludes) {
beans.remove(exclude);
}
return (context) -> {
for (Class<?> bean : beans) {
assertThat(context).hasSingleBean(bean);
}
};
private ContextConsumer<AssertableApplicationContext> assertMetricsBeans() {
return (context) -> assertThat(context).hasSingleBean(JvmGcMetrics.class)
.hasSingleBean(JvmHeapPressureMetrics.class).hasSingleBean(JvmMemoryMetrics.class)
.hasSingleBean(JvmThreadMetrics.class).hasSingleBean(ClassLoaderMetrics.class);
}
@Configuration(proxyBeanMethods = false)
@ -163,17 +95,6 @@ class JvmMetricsAutoConfigurationTests {
}
@Configuration(proxyBeanMethods = false)
@SuppressWarnings("deprecation")
static class CustomJvmGcMetricsBackwardsCompatibleConfiguration {
@Bean
io.micrometer.core.instrument.binder.jvm.JvmGcMetrics customJvmGcMetrics() {
return new io.micrometer.core.instrument.binder.jvm.JvmGcMetrics();
}
}
@Configuration(proxyBeanMethods = false)
static class CustomJvmHeapPressureMetricsConfiguration {
@ -184,17 +105,6 @@ class JvmMetricsAutoConfigurationTests {
}
@Configuration(proxyBeanMethods = false)
@SuppressWarnings("deprecation")
static class CustomJvmHeapPressureMetricsBackwardsCompatibleConfiguration {
@Bean
io.micrometer.core.instrument.binder.jvm.JvmHeapPressureMetrics customJvmHeapPressureMetrics() {
return new io.micrometer.core.instrument.binder.jvm.JvmHeapPressureMetrics();
}
}
@Configuration(proxyBeanMethods = false)
static class CustomJvmMemoryMetricsConfiguration {
@ -205,17 +115,6 @@ class JvmMetricsAutoConfigurationTests {
}
@Configuration(proxyBeanMethods = false)
@SuppressWarnings("deprecation")
static class CustomJvmMemoryMetricsBackwardsCompatibleConfiguration {
@Bean
io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics customJvmMemoryMetrics() {
return new io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics();
}
}
@Configuration(proxyBeanMethods = false)
static class CustomJvmThreadMetricsConfiguration {
@ -226,17 +125,6 @@ class JvmMetricsAutoConfigurationTests {
}
@Configuration(proxyBeanMethods = false)
@SuppressWarnings("deprecation")
static class CustomJvmThreadMetricsBackwardsCompatibleConfiguration {
@Bean
io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics customJvmThreadMetrics() {
return new io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics();
}
}
@Configuration(proxyBeanMethods = false)
static class CustomClassLoaderMetricsConfiguration {
@ -247,15 +135,4 @@ class JvmMetricsAutoConfigurationTests {
}
@Configuration(proxyBeanMethods = false)
@SuppressWarnings("deprecation")
static class CustomClassLoaderMetricsBackwardsCompatibleConfiguration {
@Bean
io.micrometer.core.instrument.binder.jvm.ClassLoaderMetrics customClassLoaderMetrics() {
return new io.micrometer.core.instrument.binder.jvm.ClassLoaderMetrics();
}
}
}

@ -16,7 +16,7 @@
package org.springframework.boot.actuate.autoconfigure.metrics;
import io.micrometer.binder.logging.Log4j2Metrics;
import io.micrometer.core.instrument.binder.logging.Log4j2Metrics;
import org.apache.logging.log4j.LogManager;
import org.junit.jupiter.api.Test;
@ -55,17 +55,6 @@ class Log4J2MetricsWithLog4jLoggerContextAutoConfigurationTests {
(context) -> assertThat(context).hasSingleBean(Log4j2Metrics.class).hasBean("customLog4J2Metrics"));
}
@Test
@Deprecated
void allowsCustomLog4J2MetricsToBeUsedBackwardsCompatible() {
assertThat(LogManager.getContext().getClass().getName())
.isEqualTo("org.apache.logging.log4j.core.LoggerContext");
this.contextRunner.withUserConfiguration(CustomLog4J2MetricsConfigurationBackwardsCompatible.class)
.run((context) -> assertThat(context)
.hasSingleBean(io.micrometer.core.instrument.binder.logging.Log4j2Metrics.class)
.doesNotHaveBean(Log4j2Metrics.class).hasBean("customLog4J2Metrics"));
}
@Configuration(proxyBeanMethods = false)
static class CustomLog4J2MetricsConfiguration {
@ -76,15 +65,4 @@ class Log4J2MetricsWithLog4jLoggerContextAutoConfigurationTests {
}
@Configuration(proxyBeanMethods = false)
@SuppressWarnings("deprecation")
static class CustomLog4J2MetricsConfigurationBackwardsCompatible {
@Bean
io.micrometer.core.instrument.binder.logging.Log4j2Metrics customLog4J2Metrics() {
return new io.micrometer.core.instrument.binder.logging.Log4j2Metrics();
}
}
}

@ -16,7 +16,7 @@
package org.springframework.boot.actuate.autoconfigure.metrics;
import io.micrometer.binder.logging.Log4j2Metrics;
import io.micrometer.core.instrument.binder.logging.Log4j2Metrics;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.slf4j.SLF4JLoggerContext;
import org.junit.jupiter.api.Test;

@ -16,7 +16,7 @@
package org.springframework.boot.actuate.autoconfigure.metrics;
import io.micrometer.binder.logging.LogbackMetrics;
import io.micrometer.core.instrument.binder.logging.LogbackMetrics;
import org.junit.jupiter.api.Test;
import org.springframework.boot.actuate.autoconfigure.metrics.test.MetricsRun;
@ -49,15 +49,6 @@ class LogbackMetricsAutoConfigurationTests {
(context) -> assertThat(context).hasSingleBean(LogbackMetrics.class).hasBean("customLogbackMetrics"));
}
@Test
@Deprecated
void allowsCustomLogbackMetricsToBeUsedBackwardsCompatible() {
this.contextRunner.withUserConfiguration(CustomLogbackMetricsConfigurationBackwardsCompatible.class)
.run((context) -> assertThat(context)
.hasSingleBean(io.micrometer.core.instrument.binder.logging.LogbackMetrics.class)
.doesNotHaveBean(LogbackMetrics.class).hasBean("customLogbackMetrics"));
}
@Configuration(proxyBeanMethods = false)
static class CustomLogbackMetricsConfiguration {
@ -68,15 +59,4 @@ class LogbackMetricsAutoConfigurationTests {
}
@Configuration(proxyBeanMethods = false)
@SuppressWarnings("deprecation")
static class CustomLogbackMetricsConfigurationBackwardsCompatible {
@Bean
io.micrometer.core.instrument.binder.logging.LogbackMetrics customLogbackMetrics() {
return new io.micrometer.core.instrument.binder.logging.LogbackMetrics();
}
}
}

@ -16,7 +16,7 @@
package org.springframework.boot.actuate.autoconfigure.metrics;
import io.micrometer.binder.logging.LogbackMetrics;
import io.micrometer.core.instrument.binder.logging.LogbackMetrics;
import org.junit.jupiter.api.Test;
import org.springframework.boot.autoconfigure.AutoConfigurations;

@ -20,10 +20,10 @@ import java.io.File;
import java.util.Arrays;
import java.util.Collections;
import io.micrometer.binder.system.FileDescriptorMetrics;
import io.micrometer.binder.system.ProcessorMetrics;
import io.micrometer.binder.system.UptimeMetrics;
import io.micrometer.core.instrument.Tags;
import io.micrometer.core.instrument.binder.system.FileDescriptorMetrics;
import io.micrometer.core.instrument.binder.system.ProcessorMetrics;
import io.micrometer.core.instrument.binder.system.UptimeMetrics;
import org.junit.jupiter.api.Test;
import org.springframework.boot.actuate.autoconfigure.metrics.test.MetricsRun;
@ -58,15 +58,6 @@ class SystemMetricsAutoConfigurationTests {
(context) -> assertThat(context).hasSingleBean(UptimeMetrics.class).hasBean("customUptimeMetrics"));
}
@Test
@Deprecated
void allowsCustomUptimeMetricsToBeUsedBackwardsCompatible() {
this.contextRunner.withUserConfiguration(CustomUptimeMetricsConfigurationBackwardsCompatible.class)
.run((context) -> assertThat(context)
.hasSingleBean(io.micrometer.core.instrument.binder.system.UptimeMetrics.class)
.doesNotHaveBean(UptimeMetrics.class).hasBean("customUptimeMetrics"));
}
@Test
void autoConfiguresProcessorMetrics() {
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(ProcessorMetrics.class));
@ -79,15 +70,6 @@ class SystemMetricsAutoConfigurationTests {
.hasBean("customProcessorMetrics"));
}
@Test
@Deprecated
void allowsCustomProcessorMetricsToBeUsedBackwardsCompatible() {
this.contextRunner.withUserConfiguration(CustomProcessorMetricsConfigurationBackwardsCompatible.class)
.run((context) -> assertThat(context)
.hasSingleBean(io.micrometer.core.instrument.binder.system.ProcessorMetrics.class)
.doesNotHaveBean(ProcessorMetrics.class).hasBean("customProcessorMetrics"));
}
@Test
void autoConfiguresFileDescriptorMetrics() {
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(FileDescriptorMetrics.class));
@ -100,15 +82,6 @@ class SystemMetricsAutoConfigurationTests {
.hasBean("customFileDescriptorMetrics"));
}
@Test
@Deprecated
void allowsCustomFileDescriptorMetricsToBeUsedBackwardsCompatible() {
this.contextRunner.withUserConfiguration(CustomFileDescriptorMetricsConfigurationBackwardsCompatible.class)
.run((context) -> assertThat(context)
.hasSingleBean(io.micrometer.core.instrument.binder.system.FileDescriptorMetrics.class)
.doesNotHaveBean(FileDescriptorMetrics.class).hasBean("customFileDescriptorMetrics"));
}
@Test
void autoConfiguresDiskSpaceMetrics() {
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(DiskSpaceMetricsBinder.class));
@ -152,17 +125,6 @@ class SystemMetricsAutoConfigurationTests {
}
@Configuration(proxyBeanMethods = false)
@SuppressWarnings("deprecation")
static class CustomUptimeMetricsConfigurationBackwardsCompatible {
@Bean
io.micrometer.core.instrument.binder.system.UptimeMetrics customUptimeMetrics() {
return new io.micrometer.core.instrument.binder.system.UptimeMetrics();
}
}
@Configuration(proxyBeanMethods = false)
static class CustomProcessorMetricsConfiguration {
@ -173,17 +135,6 @@ class SystemMetricsAutoConfigurationTests {
}
@Configuration(proxyBeanMethods = false)
@SuppressWarnings("deprecation")
static class CustomProcessorMetricsConfigurationBackwardsCompatible {
@Bean
io.micrometer.core.instrument.binder.system.ProcessorMetrics customProcessorMetrics() {
return new io.micrometer.core.instrument.binder.system.ProcessorMetrics();
}
}
@Configuration(proxyBeanMethods = false)
static class CustomFileDescriptorMetricsConfiguration {
@ -194,17 +145,6 @@ class SystemMetricsAutoConfigurationTests {
}
@Configuration(proxyBeanMethods = false)
@SuppressWarnings("deprecation")
static class CustomFileDescriptorMetricsConfigurationBackwardsCompatible {
@Bean
io.micrometer.core.instrument.binder.system.FileDescriptorMetrics customFileDescriptorMetrics() {
return new io.micrometer.core.instrument.binder.system.FileDescriptorMetrics();
}
}
@Configuration(proxyBeanMethods = false)
static class CustomDiskSpaceMetricsConfiguration {

@ -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;

@ -22,12 +22,12 @@ import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import io.micrometer.binder.jersey.server.DefaultJerseyTagsProvider;
import io.micrometer.binder.jersey.server.JerseyTagsProvider;
import io.micrometer.binder.jersey.server.MetricsApplicationEventListener;
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.Tag;
import io.micrometer.core.instrument.Timer;
import io.micrometer.core.instrument.binder.jersey.server.DefaultJerseyTagsProvider;
import io.micrometer.core.instrument.binder.jersey.server.JerseyTagsProvider;
import io.micrometer.core.instrument.binder.jersey.server.MetricsApplicationEventListener;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.server.monitoring.RequestEvent;
import org.junit.jupiter.api.Test;
@ -85,17 +85,6 @@ class JerseyServerMetricsAutoConfigurationTests {
.run((context) -> assertThat(context).hasSingleBean(CustomJerseyTagsProvider.class));
}
@Test
@Deprecated
void shouldHonorExistingTagProviderBackwardsCompatible() {
this.webContextRunner.withUserConfiguration(CustomJerseyTagsProviderBackwardsCompatibleConfiguration.class)
.run((context) -> {
assertThat(context)
.hasSingleBean(io.micrometer.core.instrument.binder.jersey.server.JerseyTagsProvider.class);
assertThat(context).doesNotHaveBean(JerseyTagsProvider.class);
});
}
@Test
void httpRequestsAreTimed() {
this.webContextRunner.run((context) -> {
@ -155,17 +144,6 @@ class JerseyServerMetricsAutoConfigurationTests {
}
@Configuration(proxyBeanMethods = false)
@SuppressWarnings("deprecation")
static class CustomJerseyTagsProviderBackwardsCompatibleConfiguration {
@Bean
io.micrometer.core.instrument.binder.jersey.server.JerseyTagsProvider customJerseyTagsProvider() {
return new CustomJerseyTagsProviderBackwardsCompatible();
}
}
static class CustomJerseyTagsProvider implements JerseyTagsProvider {
@Override
@ -180,20 +158,4 @@ class JerseyServerMetricsAutoConfigurationTests {
}
@SuppressWarnings("deprecation")
static class CustomJerseyTagsProviderBackwardsCompatible
implements io.micrometer.core.instrument.binder.jersey.server.JerseyTagsProvider {
@Override
public Iterable<Tag> httpRequestTags(RequestEvent event) {
return null;
}
@Override
public Iterable<Tag> httpLongRequestTags(RequestEvent event) {
return null;
}
}
}

@ -23,12 +23,12 @@ import com.mongodb.client.MongoClient;
import com.mongodb.client.internal.MongoClientImpl;
import com.mongodb.connection.ConnectionPoolSettings;
import com.mongodb.event.ConnectionPoolListener;
import io.micrometer.binder.mongodb.DefaultMongoCommandTagsProvider;
import io.micrometer.binder.mongodb.DefaultMongoConnectionPoolTagsProvider;
import io.micrometer.binder.mongodb.MongoCommandTagsProvider;
import io.micrometer.binder.mongodb.MongoConnectionPoolTagsProvider;
import io.micrometer.binder.mongodb.MongoMetricsCommandListener;
import io.micrometer.binder.mongodb.MongoMetricsConnectionPoolListener;
import io.micrometer.core.instrument.binder.mongodb.DefaultMongoCommandTagsProvider;
import io.micrometer.core.instrument.binder.mongodb.DefaultMongoConnectionPoolTagsProvider;
import io.micrometer.core.instrument.binder.mongodb.MongoCommandTagsProvider;
import io.micrometer.core.instrument.binder.mongodb.MongoConnectionPoolTagsProvider;
import io.micrometer.core.instrument.binder.mongodb.MongoMetricsCommandListener;
import io.micrometer.core.instrument.binder.mongodb.MongoMetricsConnectionPoolListener;
import org.junit.jupiter.api.Test;
import org.springframework.boot.actuate.autoconfigure.metrics.test.MetricsRun;
@ -93,7 +93,7 @@ class MongoMetricsAutoConfigurationTests {
@Test
void whenThereIsACustomMetricsCommandTagsProviderItIsUsed() {
MongoCommandTagsProvider customTagsProvider = mock(MongoCommandTagsProvider.class);
final MongoCommandTagsProvider customTagsProvider = mock(MongoCommandTagsProvider.class);
this.contextRunner.with(MetricsRun.simple())
.withConfiguration(AutoConfigurations.of(MongoAutoConfiguration.class))
.withBean("customMongoCommandTagsProvider", MongoCommandTagsProvider.class, () -> customTagsProvider)
@ -101,27 +101,9 @@ class MongoMetricsAutoConfigurationTests {
.isSameAs(customTagsProvider));
}
@Test
@Deprecated
void whenThereIsACustomMetricsCommandTagsProviderItIsUsedBackwardsCompatible() {
io.micrometer.core.instrument.binder.mongodb.MongoCommandTagsProvider customTagsProvider = mock(
io.micrometer.core.instrument.binder.mongodb.MongoCommandTagsProvider.class);
this.contextRunner.with(MetricsRun.simple())
.withConfiguration(AutoConfigurations.of(MongoAutoConfiguration.class))
.withBean("customMongoCommandTagsProvider",
io.micrometer.core.instrument.binder.mongodb.MongoCommandTagsProvider.class,
() -> customTagsProvider)
.run((context) -> {
assertThat(context).hasBean("customMongoCommandTagsProvider");
assertThat(context)
.hasSingleBean(io.micrometer.core.instrument.binder.mongodb.MongoCommandTagsProvider.class);
assertThat(context).doesNotHaveBean(MongoCommandTagsProvider.class);
});
}
@Test
void whenThereIsACustomMetricsConnectionPoolTagsProviderItIsUsed() {
MongoConnectionPoolTagsProvider customTagsProvider = mock(MongoConnectionPoolTagsProvider.class);
final MongoConnectionPoolTagsProvider customTagsProvider = mock(MongoConnectionPoolTagsProvider.class);
this.contextRunner.with(MetricsRun.simple())
.withConfiguration(AutoConfigurations.of(MongoAutoConfiguration.class))
.withBean("customMongoConnectionPoolTagsProvider", MongoConnectionPoolTagsProvider.class,
@ -130,25 +112,6 @@ class MongoMetricsAutoConfigurationTests {
.isSameAs(customTagsProvider));
}
@Test
@Deprecated
void whenThereIsACustomMetricsConnectionPoolTagsProviderItIsUsedBackwardsCompatible() {
io.micrometer.core.instrument.binder.mongodb.MongoConnectionPoolTagsProvider customTagsProvider = mock(
io.micrometer.core.instrument.binder.mongodb.MongoConnectionPoolTagsProvider.class);
this.contextRunner.with(MetricsRun.simple())
.withConfiguration(AutoConfigurations.of(MongoAutoConfiguration.class))
.withBean("customMongoConnectionPoolTagsProvider",
io.micrometer.core.instrument.binder.mongodb.MongoConnectionPoolTagsProvider.class,
() -> customTagsProvider)
.run((context) -> {
assertThat(context).hasBean("customMongoConnectionPoolTagsProvider");
assertThat(context).hasSingleBean(
io.micrometer.core.instrument.binder.mongodb.MongoConnectionPoolTagsProvider.class);
assertThat(context).doesNotHaveBean(MongoConnectionPoolTagsProvider.class);
});
}
@Test
void whenThereIsNoMongoClientSettingsOnClasspathThenNoMetricsCommandListenerIsAdded() {
this.contextRunner.with(MetricsRun.simple())
@ -213,25 +176,26 @@ class MongoMetricsAutoConfigurationTests {
}
private MongoClientSettings getActualMongoClientSettingsUsedToConstructClient(
AssertableApplicationContext context) {
MongoClientImpl mongoClient = (MongoClientImpl) context.getBean(MongoClient.class);
final AssertableApplicationContext context) {
final MongoClientImpl mongoClient = (MongoClientImpl) context.getBean(MongoClient.class);
return mongoClient.getSettings();
}
private List<ConnectionPoolListener> getConnectionPoolListenersFromClient(AssertableApplicationContext context) {
private List<ConnectionPoolListener> getConnectionPoolListenersFromClient(
final AssertableApplicationContext context) {
MongoClientSettings mongoClientSettings = getActualMongoClientSettingsUsedToConstructClient(context);
ConnectionPoolSettings connectionPoolSettings = mongoClientSettings.getConnectionPoolSettings();
return connectionPoolSettings.getConnectionPoolListeners();
}
private MongoCommandTagsProvider getMongoCommandTagsProviderUsedToConstructListener(
AssertableApplicationContext context) {
final AssertableApplicationContext context) {
MongoMetricsCommandListener listener = context.getBean(MongoMetricsCommandListener.class);
return (MongoCommandTagsProvider) ReflectionTestUtils.getField(listener, "tagsProvider");
}
private MongoConnectionPoolTagsProvider getMongoConnectionPoolTagsProviderUsedToConstructListener(
AssertableApplicationContext context) {
final AssertableApplicationContext context) {
MongoMetricsConnectionPoolListener listener = context.getBean(MongoMetricsConnectionPoolListener.class);
return (MongoConnectionPoolTagsProvider) ReflectionTestUtils.getField(listener, "tagsProvider");
}

@ -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;

@ -16,13 +16,9 @@
package org.springframework.boot.actuate.autoconfigure.metrics.web.jetty;
import io.micrometer.binder.jetty.JettyConnectionMetrics;
import io.micrometer.binder.jetty.JettyServerThreadPoolMetrics;
import io.micrometer.binder.jetty.JettySslHandshakeMetrics;
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.Tags;
import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
import org.eclipse.jetty.util.thread.ThreadPool;
import org.junit.jupiter.api.Test;
import org.springframework.boot.SpringApplication;
@ -90,28 +86,6 @@ class JettyMetricsAutoConfigurationTests {
.hasBean("customJettyServerThreadPoolMetricsBinder"));
}
@Test
void allowsCustomJettyServerThreadPoolMetrics() {
new WebApplicationContextRunner().withConfiguration(AutoConfigurations.of(JettyMetricsAutoConfiguration.class))
.withUserConfiguration(CustomJettyServerThreadPoolMetrics.class, MeterRegistryConfiguration.class)
.run((context) -> assertThat(context).hasSingleBean(JettyServerThreadPoolMetrics.class)
.doesNotHaveBean(JettyServerThreadPoolMetricsBinder.class)
.hasBean("customJettyServerThreadPoolMetrics"));
}
@Test
@Deprecated
void allowsCustomJettyServerThreadPoolMetricsBackwardsCompatible() {
new WebApplicationContextRunner().withConfiguration(AutoConfigurations.of(JettyMetricsAutoConfiguration.class))
.withUserConfiguration(CustomJettyServerThreadPoolMetricsBackwardsCompatible.class,
MeterRegistryConfiguration.class)
.run((context) -> assertThat(context)
.hasSingleBean(io.micrometer.core.instrument.binder.jetty.JettyServerThreadPoolMetrics.class)
.doesNotHaveBean(JettyServerThreadPoolMetrics.class)
.doesNotHaveBean(JettyServerThreadPoolMetricsBinder.class)
.hasBean("customJettyServerThreadPoolMetrics"));
}
@Test
void autoConfiguresConnectionMetricsWithEmbeddedServletJetty() {
new WebApplicationContextRunner(AnnotationConfigServletWebServerApplicationContext::new)
@ -156,26 +130,6 @@ class JettyMetricsAutoConfigurationTests {
});
}
@Test
void allowsCustomJettyConnectionMetrics() {
new WebApplicationContextRunner().withConfiguration(AutoConfigurations.of(JettyMetricsAutoConfiguration.class))
.withUserConfiguration(CustomJettyConnectionMetrics.class, MeterRegistryConfiguration.class)
.run((context) -> assertThat(context).hasSingleBean(JettyConnectionMetrics.class)
.doesNotHaveBean(JettyConnectionMetricsBinder.class).hasBean("customJettyConnectionMetrics"));
}
@Test
@Deprecated
void allowsCustomJettyConnectionMetricsBackwardsCompatible() {
new WebApplicationContextRunner().withConfiguration(AutoConfigurations.of(JettyMetricsAutoConfiguration.class))
.withUserConfiguration(CustomJettyConnectionMetricsBackwardsCompatible.class,
MeterRegistryConfiguration.class)
.run((context) -> assertThat(context)
.hasSingleBean(io.micrometer.core.instrument.binder.jetty.JettyConnectionMetrics.class)
.doesNotHaveBean(JettyConnectionMetrics.class)
.doesNotHaveBean(JettyConnectionMetricsBinder.class).hasBean("customJettyConnectionMetrics"));
}
@Test
void autoConfiguresSslHandshakeMetricsWithEmbeddedServletJetty() {
new WebApplicationContextRunner(AnnotationConfigServletWebServerApplicationContext::new)
@ -233,28 +187,6 @@ class JettyMetricsAutoConfigurationTests {
.hasBean("customJettySslHandshakeMetricsBinder"));
}
@Test
void allowsCustomJettySslHandshakeMetrics() {
new WebApplicationContextRunner().withConfiguration(AutoConfigurations.of(JettyMetricsAutoConfiguration.class))
.withUserConfiguration(CustomJettySslHandshakeMetrics.class, MeterRegistryConfiguration.class)
.run((context) -> assertThat(context).hasSingleBean(JettySslHandshakeMetrics.class)
.doesNotHaveBean(JettySslHandshakeMetricsBinder.class)
.hasBean("customJettySslHandshakeMetrics"));
}
@Test
@Deprecated
void allowsCustomJettySslHandshakeMetricsBackwardsCompatible() {
new WebApplicationContextRunner().withConfiguration(AutoConfigurations.of(JettyMetricsAutoConfiguration.class))
.withUserConfiguration(CustomJettySslHandshakeMetricsBackwardsCompatible.class,
MeterRegistryConfiguration.class)
.run((context) -> assertThat(context)
.hasSingleBean(io.micrometer.core.instrument.binder.jetty.JettySslHandshakeMetrics.class)
.doesNotHaveBean(JettySslHandshakeMetrics.class)
.doesNotHaveBean(JettySslHandshakeMetricsBinder.class)
.hasBean("customJettySslHandshakeMetrics"));
}
@Test
void doesNotAutoConfigureSslHandshakeMetricsWhenSslEnabledPropertyNotSpecified() {
new WebApplicationContextRunner(AnnotationConfigServletWebServerApplicationContext::new)
@ -323,28 +255,6 @@ class JettyMetricsAutoConfigurationTests {
}
@Configuration(proxyBeanMethods = false)
static class CustomJettyServerThreadPoolMetrics {
@Bean
JettyServerThreadPoolMetrics customJettyServerThreadPoolMetrics() {
return new JettyServerThreadPoolMetrics(mock(ThreadPool.class), Tags.empty());
}
}
@Configuration(proxyBeanMethods = false)
@SuppressWarnings("deprecation")
static class CustomJettyServerThreadPoolMetricsBackwardsCompatible {
@Bean
io.micrometer.core.instrument.binder.jetty.JettyServerThreadPoolMetrics customJettyServerThreadPoolMetrics() {
return new io.micrometer.core.instrument.binder.jetty.JettyServerThreadPoolMetrics(mock(ThreadPool.class),
Tags.empty());
}
}
@Configuration(proxyBeanMethods = false)
static class CustomJettyConnectionMetricsBinder {
@ -355,28 +265,6 @@ class JettyMetricsAutoConfigurationTests {
}
@Configuration(proxyBeanMethods = false)
static class CustomJettyConnectionMetrics {
@Bean
JettyConnectionMetrics customJettyConnectionMetrics(MeterRegistry meterRegistry) {
return new JettyConnectionMetrics(meterRegistry);
}
}
@Configuration(proxyBeanMethods = false)
@SuppressWarnings("deprecation")
static class CustomJettyConnectionMetricsBackwardsCompatible {
@Bean
io.micrometer.core.instrument.binder.jetty.JettyConnectionMetrics customJettyConnectionMetrics(
MeterRegistry meterRegistry) {
return new io.micrometer.core.instrument.binder.jetty.JettyConnectionMetrics(meterRegistry);
}
}
@Configuration(proxyBeanMethods = false)
static class CustomJettySslHandshakeMetricsBinder {
@ -387,26 +275,4 @@ class JettyMetricsAutoConfigurationTests {
}
@Configuration(proxyBeanMethods = false)
static class CustomJettySslHandshakeMetrics {
@Bean
JettySslHandshakeMetrics customJettySslHandshakeMetrics(MeterRegistry meterRegistry) {
return new JettySslHandshakeMetrics(meterRegistry);
}
}
@Configuration(proxyBeanMethods = false)
@SuppressWarnings("deprecation")
static class CustomJettySslHandshakeMetricsBackwardsCompatible {
@Bean
io.micrometer.core.instrument.binder.jetty.JettySslHandshakeMetrics customJettySslHandshakeMetrics(
MeterRegistry meterRegistry) {
return new io.micrometer.core.instrument.binder.jetty.JettySslHandshakeMetrics(meterRegistry);
}
}
}

@ -19,8 +19,8 @@ package org.springframework.boot.actuate.autoconfigure.metrics.web.tomcat;
import java.util.Collections;
import java.util.concurrent.atomic.AtomicInteger;
import io.micrometer.binder.tomcat.TomcatMetrics;
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.binder.tomcat.TomcatMetrics;
import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
import org.apache.tomcat.util.modeler.Registry;
import org.junit.jupiter.api.Test;
@ -108,16 +108,6 @@ class TomcatMetricsAutoConfigurationTests {
.hasBean("customTomcatMetrics"));
}
@Test
@Deprecated
void allowsCustomTomcatMetricsToBeUsedBackwardsCompatible() {
new WebApplicationContextRunner().withConfiguration(AutoConfigurations.of(TomcatMetricsAutoConfiguration.class))
.withUserConfiguration(MeterRegistryConfiguration.class, CustomTomcatMetricsBackwardsCompatible.class)
.run((context) -> assertThat(context).doesNotHaveBean(TomcatMetricsBinder.class)
.hasSingleBean(io.micrometer.core.instrument.binder.tomcat.TomcatMetrics.class)
.doesNotHaveBean(TomcatMetrics.class).hasBean("customTomcatMetrics"));
}
private ApplicationStartedEvent createApplicationStartedEvent(ConfigurableApplicationContext context) {
return new ApplicationStartedEvent(new SpringApplication(), null, context, null);
}
@ -174,17 +164,6 @@ class TomcatMetricsAutoConfigurationTests {
}
@Configuration(proxyBeanMethods = false)
@SuppressWarnings("deprecation")
static class CustomTomcatMetricsBackwardsCompatible {
@Bean
io.micrometer.core.instrument.binder.tomcat.TomcatMetrics customTomcatMetrics() {
return new io.micrometer.core.instrument.binder.tomcat.TomcatMetrics(null, Collections.emptyList());
}
}
@Configuration(proxyBeanMethods = false)
static class CustomTomcatMetricsBinder {

@ -23,7 +23,6 @@ dependencies {
optional("com.zaxxer:HikariCP")
optional("io.lettuce:lettuce-core")
optional("io.micrometer:micrometer-core")
optional("io.micrometer:micrometer-binders")
optional("io.micrometer:micrometer-registry-prometheus")
optional("io.prometheus:simpleclient_pushgateway") {
exclude(group: "javax.xml.bind", module: "jaxb-api")

@ -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;

@ -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;

@ -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;

@ -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;

@ -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;

@ -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;
/**

@ -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;

@ -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;
/**

@ -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;

@ -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;

@ -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;

@ -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;

@ -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;

@ -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;

@ -1280,9 +1280,6 @@ bom {
}
}
library("Micrometer", "1.9.0-SNAPSHOT") {
prohibit("[2.0.0-M1,)") {
because "we upgrade in Spring Boot 3.x"
}
group("io.micrometer") {
modules = [
"micrometer-registry-stackdriver" {

@ -77,7 +77,6 @@ dependencies {
implementation("ch.qos.logback:logback-classic")
implementation("com.zaxxer:HikariCP")
implementation("io.micrometer:micrometer-core")
implementation("io.micrometer:micrometer-binders")
implementation("io.micrometer:micrometer-registry-graphite")
implementation("io.micrometer:micrometer-registry-jmx")
implementation("io.projectreactor.netty:reactor-netty-http")

@ -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 {

@ -16,7 +16,7 @@
package org.springframework.boot.docs.actuator.metrics.supported.mongodb.command;
import io.micrometer.binder.mongodb.MongoCommandTagsProvider;
import io.micrometer.core.instrument.binder.mongodb.MongoCommandTagsProvider;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@ -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 {

@ -16,7 +16,7 @@
package org.springframework.boot.docs.actuator.metrics.supported.mongodb.connectionpool;
import io.micrometer.binder.mongodb.MongoConnectionPoolTagsProvider;
import io.micrometer.core.instrument.binder.mongodb.MongoConnectionPoolTagsProvider;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@ -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()
}
}
}

@ -16,7 +16,7 @@
package org.springframework.boot.docs.actuator.metrics.supported.mongodb.command
import io.micrometer.binder.mongodb.MongoCommandTagsProvider
import io.micrometer.core.instrument.binder.mongodb.MongoCommandTagsProvider
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
@ -28,4 +28,4 @@ class MyCommandTagsProviderConfiguration {
return CustomCommandTagsProvider()
}
}
}

@ -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()
}
}
}

@ -16,7 +16,7 @@
package org.springframework.boot.docs.actuator.metrics.supported.mongodb.connectionpool
import io.micrometer.binder.mongodb.MongoConnectionPoolTagsProvider
import io.micrometer.core.instrument.binder.mongodb.MongoConnectionPoolTagsProvider
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
@ -28,4 +28,4 @@ class MyConnectionPoolTagsProviderConfiguration {
return CustomConnectionPoolTagsProvider()
}
}
}

@ -8,5 +8,4 @@ dependencies {
api(project(":spring-boot-project:spring-boot-starters:spring-boot-starter"))
api(project(":spring-boot-project:spring-boot-actuator-autoconfigure"))
api("io.micrometer:micrometer-core")
api("io.micrometer:micrometer-binders")
}

@ -84,7 +84,6 @@ dependencies {
testImplementation("com.unboundid:unboundid-ldapsdk")
testImplementation("io.lettuce:lettuce-core")
testImplementation("io.micrometer:micrometer-registry-prometheus")
testImplementation("io.micrometer:micrometer-binders")
testImplementation("io.projectreactor.netty:reactor-netty-http")
testImplementation("io.projectreactor:reactor-core")
testImplementation("io.projectreactor:reactor-test")

Loading…
Cancel
Save