diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/simple/SimpleMetricsExportAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/simple/SimpleMetricsExportAutoConfiguration.java index d0796ca2a0..8b1fd96b39 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/simple/SimpleMetricsExportAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/simple/SimpleMetricsExportAutoConfiguration.java @@ -47,7 +47,7 @@ import org.springframework.context.annotation.Configuration; @ConditionalOnBean(Clock.class) @EnableConfigurationProperties(SimpleProperties.class) @ConditionalOnMissingBean(MeterRegistry.class) -@ConditionalOnProperty(prefix = "management.metrics.export.simple", name = "enabled", havingValue = "true", matchIfMissing = true) +@ConditionalOnProperty(name = "management.metrics.export.simple.enabled", havingValue = "true", matchIfMissing = true) public class SimpleMetricsExportAutoConfiguration { @Bean 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 ea0dacc0cf..541952fc05 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 @@ -33,12 +33,6 @@ import org.springframework.boot.context.properties.ConfigurationProperties; @ConfigurationProperties(prefix = "management.metrics.export.simple") public class SimpleProperties { - /** - * Enable in-memory metrics that aren't published anywhere (allows you to see - * what metrics are collected in the metrics actuator endpoint). - */ - private boolean enabled; - /** * Step size (i.e. reporting frequency) to use. */ @@ -49,14 +43,6 @@ public class SimpleProperties { */ private CountingMode mode = CountingMode.CUMULATIVE; - public boolean getEnabled() { - return this.enabled; - } - - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } - public Duration getStep() { return this.step; } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json index 9632126d2c..28a213cb61 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -215,6 +215,12 @@ "description": "Whether to enable uptime metrics.", "defaultValue": true }, + { + "name": "management.metrics.export.simple.enabled", + "type": "java.lang.Boolean", + "description": "Whether, in the absence of any other exporter, exporting of metrics to an in-memory backend is enabled.", + "defaultValue": true + }, { "name": "management.trace.http.enabled", "type": "java.lang.Boolean", diff --git a/spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc b/spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc index 051ee33b31..27e7fee501 100644 --- a/spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc +++ b/spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc @@ -1384,7 +1384,7 @@ content into your application. Rather, pick only the properties that you need. management.metrics.export.signalfx.uri= # Optional custom URI for the SignalFX API. management.metrics.export.simple.mode=cumulative # Counting mode. management.metrics.export.simple.step=10s # Step size (i.e. reporting frequency) to use. - management.metrics.export.statsd.enabled= # Whether exporting of metrics to this backend is enabled. + management.metrics.export.statsd.enabled=true # Whether, in the absence of any other exporter, exporting of metrics to an in-memory backend is enabled. management.metrics.export.statsd.flavor=datadog # StatsD line protocol to use. management.metrics.export.statsd.host=localhost # Host of the StatsD server to receive exported metrics. management.metrics.export.statsd.max-packet-length=1400 # Total length of a single payload should be kept within your network's MTU. diff --git a/spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc b/spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc index 7504de0c0d..c3893cf4c8 100644 --- a/spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc +++ b/spring-boot-project/spring-boot-docs/src/main/asciidoc/production-ready-features.adoc @@ -1272,6 +1272,22 @@ using: +[[production-ready-metrics-export-simple]] +==== Simple +Micrometer ships with a simple, in-memory backend that is automatically used as a fallback +if no other registry is configured. This allows you to see what metrics are collected in +the <>. + +The in-memory backend disables itself as soon as you're using any of the other available +backend. You can also disable it explicitly: + +[source,properties,indent=0] +---- + management.metrics.export.simple.enabled=false +---- + + + [[production-ready-metrics-export-newrelic]] ==== New Relic New Relic registry pushes metrics to New Relic periodically. To export metrics to