Start building against Micrometer 2.0.0-M3

See gh-29753
This commit is contained in:
Moritz Halbritter 2022-03-04 10:43:15 +01:00
parent d79fb60398
commit 1793cee00f
51 changed files with 109 additions and 142 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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.
@ -22,7 +22,6 @@ import java.util.concurrent.TimeUnit;
import info.ganglia.gmetric4j.gmetric.GMetric;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
/**
* {@link ConfigurationProperties @ConfigurationProperties} for configuring Ganglia
@ -97,17 +96,6 @@ public class GangliaProperties {
this.step = step;
}
@Deprecated
@DeprecatedConfigurationProperty(reason = "No longer used by Micrometer.")
public TimeUnit getRateUnits() {
return this.rateUnits;
}
@Deprecated
public void setRateUnits(TimeUnit rateUnits) {
this.rateUnits = rateUnits;
}
public TimeUnit getDurationUnits() {
return this.durationUnits;
}
@ -116,17 +104,6 @@ public class GangliaProperties {
this.durationUnits = durationUnits;
}
@Deprecated
@DeprecatedConfigurationProperty(reason = "No longer used by Micrometer.")
public String getProtocolVersion() {
return this.protocolVersion;
}
@Deprecated
public void setProtocolVersion(String protocolVersion) {
this.protocolVersion = protocolVersion;
}
public GMetric.UDPAddressingMode getAddressingMode() {
return this.addressingMode;
}

View File

@ -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.
@ -56,23 +56,11 @@ class GangliaPropertiesConfigAdapter extends PropertiesConfigAdapter<GangliaProp
return get(GangliaProperties::getStep, GangliaConfig.super::step);
}
@Override
@Deprecated
public TimeUnit rateUnits() {
return get(GangliaProperties::getRateUnits, GangliaConfig.super::rateUnits);
}
@Override
public TimeUnit durationUnits() {
return get(GangliaProperties::getDurationUnits, GangliaConfig.super::durationUnits);
}
@Override
@Deprecated
public String protocolVersion() {
return get(GangliaProperties::getProtocolVersion, GangliaConfig.super::protocolVersion);
}
@Override
public GMetric.UDPAddressingMode addressingMode() {
return get(GangliaProperties::getAddressingMode, GangliaConfig.super::addressingMode);

View File

@ -17,13 +17,13 @@
package org.springframework.boot.actuate.autoconfigure.metrics.mongo;
import com.mongodb.MongoClientSettings;
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.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;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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.
@ -29,15 +29,12 @@ import static org.assertj.core.api.Assertions.assertThat;
class GangliaPropertiesTests {
@Test
@SuppressWarnings("deprecation")
void defaultValuesAreConsistent() {
GangliaProperties properties = new GangliaProperties();
GangliaConfig config = GangliaConfig.DEFAULT;
assertThat(properties.isEnabled()).isEqualTo(config.enabled());
assertThat(properties.getStep()).isEqualTo(config.step());
assertThat(properties.getRateUnits()).isEqualTo(config.rateUnits());
assertThat(properties.getDurationUnits()).isEqualTo(config.durationUnits());
assertThat(properties.getProtocolVersion()).isEqualTo(config.protocolVersion());
assertThat(properties.getAddressingMode()).isEqualTo(config.addressingMode());
assertThat(properties.getTimeToLive()).isEqualTo(config.ttl());
assertThat(properties.getHost()).isEqualTo(config.host());

View File

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

View File

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

View File

@ -22,11 +22,11 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.CyclicBarrier;
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 jakarta.servlet.DispatcherType;

View File

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

View File

@ -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")

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -134,8 +134,8 @@ public class WebMvcMetricsFilter extends OncePerRequestFilter {
Object handler = getHandler(request);
Set<Timed> annotations = getTimedAnnotations(handler);
Timer.Sample timerSample = timingContext.getTimerSample();
AutoTimer.apply(this.autoTimer, this.metricName, annotations,
(builder) -> timerSample.stop(getTimer(builder, handler, request, response, exception)));
AutoTimer.apply(this.autoTimer, this.metricName, annotations, (builder) -> timerSample
.stop(getTimer(builder, handler, request, response, exception).register(this.registry)));
}
catch (Exception ex) {
logger.warn("Failed to record timer metrics", ex);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -951,7 +951,7 @@ bom {
]
}
}
library("Micrometer", "2.0.0-M1") {
library("Micrometer", "2.0.0-SNAPSHOT") {
group("io.micrometer") {
modules = [
"micrometer-registry-stackdriver" {

View File

@ -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")

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -77,6 +77,7 @@ 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")