diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterBindersConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterBindersConfiguration.java index 3801f57cf4..7bd727c22b 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterBindersConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/MeterBindersConfiguration.java @@ -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", 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", matchIfMissing = true) @ConditionalOnClass(name = "ch.qos.logback.classic.Logger") public LogbackMetrics logbackMetrics() { return new LogbackMetrics(); } @Bean + @ConditionalOnProperty(value = "spring.metrics.binders.uptime.enabled", matchIfMissing = true) @ConditionalOnMissingBean(UptimeMetrics.class) public UptimeMetrics uptimeMetrics() { return new UptimeMetrics(); } @Bean + @ConditionalOnProperty(value = "spring.metrics.binders.processor.enabled", matchIfMissing = true) @ConditionalOnMissingBean(ProcessorMetrics.class) public ProcessorMetrics processorMetrics() { return new ProcessorMetrics(); diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/simple/SimpleProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/simple/SimpleProperties.java index ff37b8b704..d5900dea31 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/simple/SimpleProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/simple/SimpleProperties.java @@ -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,11 @@ public class SimpleProperties { */ private Duration step = Duration.ofSeconds(10); + /** + * Counting mode. + */ + private CountingMode mode = CountingMode.Cumulative; + public boolean getEnabled() { return this.enabled; } @@ -57,4 +63,13 @@ public class SimpleProperties { public void setStep(Duration step) { this.step = step; } + + public CountingMode getMode() { + return this.mode; + } + + public void setMode(CountingMode mode) { + this.mode = mode; + } + } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/simple/SimplePropertiesConfigAdapter.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/simple/SimplePropertiesConfigAdapter.java index d851c9034f..d51c5f48c4 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/simple/SimplePropertiesConfigAdapter.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/simple/SimplePropertiesConfigAdapter.java @@ -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,10 @@ public class SimplePropertiesConfigAdapter public Duration step() { return get(SimpleProperties::getStep, SimpleConfig.super::step); } + + @Override + public CountingMode mode() { + return get(SimpleProperties::getMode, SimpleConfig.super::mode); + } + } diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilter.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilter.java index 29028e6a05..a578694e83 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilter.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/servlet/WebMvcMetricsFilter.java @@ -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); diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index e754db035a..38a2032a4c 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -112,7 +112,7 @@ 1.2.3 1.16.18 2.2.0 - 1.0.0-rc.3 + 1.0.0-rc.5 6.2.2.jre8 2.12.0 1.6.0