mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Upgrade to micrometer 1.0.0-rc.5
See gh-11071
This commit is contained in:
parent
24f681826c
commit
2e0a915281
@ -24,6 +24,7 @@ import io.micrometer.core.instrument.binder.system.UptimeMetrics;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@ -36,6 +37,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
class MeterBindersConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(value = "spring.metrics.binders.jvmmemory.enabled", havingValue = "true", matchIfMissing = true)
|
||||
@ConditionalOnMissingBean(JvmMemoryMetrics.class)
|
||||
public JvmMemoryMetrics jvmMemoryMetrics() {
|
||||
return new JvmMemoryMetrics();
|
||||
@ -43,18 +45,21 @@ class MeterBindersConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(LogbackMetrics.class)
|
||||
@ConditionalOnProperty(value = "spring.metrics.binders.logback.enabled", havingValue = "true", matchIfMissing = true)
|
||||
@ConditionalOnClass(name = "ch.qos.logback.classic.Logger")
|
||||
public LogbackMetrics logbackMetrics() {
|
||||
return new LogbackMetrics();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(value = "spring.metrics.binders.uptime.enabled", havingValue = "true", matchIfMissing = true)
|
||||
@ConditionalOnMissingBean(UptimeMetrics.class)
|
||||
public UptimeMetrics uptimeMetrics() {
|
||||
return new UptimeMetrics();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(value = "spring.metrics.binders.processor.enabled", havingValue = "true", matchIfMissing = true)
|
||||
@ConditionalOnMissingBean(ProcessorMetrics.class)
|
||||
public ProcessorMetrics processorMetrics() {
|
||||
return new ProcessorMetrics();
|
||||
|
@ -18,6 +18,7 @@ package org.springframework.boot.actuate.autoconfigure.metrics.export.simple;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import io.micrometer.core.instrument.simple.CountingMode;
|
||||
import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
@ -42,6 +43,8 @@ public class SimpleProperties {
|
||||
*/
|
||||
private Duration step = Duration.ofSeconds(10);
|
||||
|
||||
private CountingMode mode = CountingMode.Cumulative;
|
||||
|
||||
public boolean getEnabled() {
|
||||
return this.enabled;
|
||||
}
|
||||
@ -57,4 +60,12 @@ public class SimpleProperties {
|
||||
public void setStep(Duration step) {
|
||||
this.step = step;
|
||||
}
|
||||
|
||||
public CountingMode getMode() {
|
||||
return mode;
|
||||
}
|
||||
|
||||
public void setMode(CountingMode mode) {
|
||||
this.mode = mode;
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ package org.springframework.boot.actuate.autoconfigure.metrics.export.simple;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import io.micrometer.core.instrument.simple.CountingMode;
|
||||
import io.micrometer.core.instrument.simple.SimpleConfig;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.metrics.export.PropertiesConfigAdapter;
|
||||
@ -49,4 +50,9 @@ public class SimplePropertiesConfigAdapter
|
||||
public Duration step() {
|
||||
return get(SimpleProperties::getStep, SimpleConfig.super::step);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CountingMode mode() {
|
||||
return get(SimpleProperties::getMode, SimpleConfig.super::mode);
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public class WebMvcMetricsFilter extends OncePerRequestFilter {
|
||||
|
||||
private void filterWithMetrics(HttpServletRequest request,
|
||||
HttpServletResponse response, FilterChain filterChain, Object handler)
|
||||
throws IOException, ServletException, NestedServletException {
|
||||
throws IOException, ServletException {
|
||||
this.webMvcMetrics.preHandle(request, handler);
|
||||
try {
|
||||
filterChain.doFilter(request, response);
|
||||
|
@ -112,7 +112,7 @@
|
||||
<logback.version>1.2.3</logback.version>
|
||||
<lombok.version>1.16.18</lombok.version>
|
||||
<mariadb.version>2.2.0</mariadb.version>
|
||||
<micrometer.version>1.0.0-rc.3</micrometer.version>
|
||||
<micrometer.version>1.0.0-rc.5</micrometer.version>
|
||||
<mssql-jdbc.version>6.2.2.jre8</mssql-jdbc.version>
|
||||
<mockito.version>2.12.0</mockito.version>
|
||||
<mongo-driver-reactivestreams.version>1.6.0</mongo-driver-reactivestreams.version>
|
||||
|
Loading…
Reference in New Issue
Block a user