diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/jmx/JmxProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/jmx/JmxProperties.java index 89167322bc56..3e3d19db8c0e 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/jmx/JmxProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/jmx/JmxProperties.java @@ -31,6 +31,11 @@ @ConfigurationProperties(prefix = "management.jmx.metrics.export") public class JmxProperties { + /** + * Whether exporting of metrics to this backend is enabled. + */ + private boolean enabled = true; + /** * Metrics JMX domain name. */ @@ -57,4 +62,12 @@ public void setStep(Duration step) { this.step = step; } + public boolean isEnabled() { + return this.enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/prometheus/PrometheusProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/prometheus/PrometheusProperties.java index 2c8dc8cefce1..ad33ee45e403 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/prometheus/PrometheusProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/prometheus/PrometheusProperties.java @@ -36,6 +36,11 @@ @ConfigurationProperties(prefix = "management.prometheus.metrics.export") public class PrometheusProperties { + /** + * Whether exporting of metrics to this backend is enabled. + */ + private boolean enabled = true; + /** * Whether to enable publishing descriptions as part of the scrape payload to * Prometheus. Turn this off to minimize the amount of data sent on each scrape. @@ -86,6 +91,14 @@ public Pushgateway getPushgateway() { return this.pushgateway; } + public boolean isEnabled() { + return this.enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + /** * Configuration options for push-based interaction with Prometheus. */ 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 eece0547f47b..d2b464cb5047 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 @@ -34,6 +34,11 @@ @ConfigurationProperties(prefix = "management.simple.metrics.export") public class SimpleProperties { + /** + * Whether exporting of metrics to this backend is enabled. + */ + private boolean enabled = true; + /** * Step size (i.e. reporting frequency) to use. */ @@ -60,4 +65,12 @@ public void setMode(CountingMode mode) { this.mode = mode; } + public boolean isEnabled() { + return this.enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + }