Skip to content

Commit d17c17d

Browse files
committed
Add enabled fields in JMX, Prometheus and Simple metrics properties
See spring-projectsgh-30381
1 parent 9fc649d commit d17c17d

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/jmx/JmxProperties.java

+13
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131
@ConfigurationProperties(prefix = "management.jmx.metrics.export")
3232
public class JmxProperties {
3333

34+
/**
35+
* Whether exporting of metrics to this backend is enabled.
36+
*/
37+
private boolean enabled = true;
38+
3439
/**
3540
* Metrics JMX domain name.
3641
*/
@@ -57,4 +62,12 @@ public void setStep(Duration step) {
5762
this.step = step;
5863
}
5964

65+
public boolean isEnabled() {
66+
return this.enabled;
67+
}
68+
69+
public void setEnabled(boolean enabled) {
70+
this.enabled = enabled;
71+
}
72+
6073
}

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/prometheus/PrometheusProperties.java

+13
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@
3636
@ConfigurationProperties(prefix = "management.prometheus.metrics.export")
3737
public class PrometheusProperties {
3838

39+
/**
40+
* Whether exporting of metrics to this backend is enabled.
41+
*/
42+
private boolean enabled = true;
43+
3944
/**
4045
* Whether to enable publishing descriptions as part of the scrape payload to
4146
* Prometheus. Turn this off to minimize the amount of data sent on each scrape.
@@ -86,6 +91,14 @@ public Pushgateway getPushgateway() {
8691
return this.pushgateway;
8792
}
8893

94+
public boolean isEnabled() {
95+
return this.enabled;
96+
}
97+
98+
public void setEnabled(boolean enabled) {
99+
this.enabled = enabled;
100+
}
101+
89102
/**
90103
* Configuration options for push-based interaction with Prometheus.
91104
*/

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/simple/SimpleProperties.java

+13
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@
3434
@ConfigurationProperties(prefix = "management.simple.metrics.export")
3535
public class SimpleProperties {
3636

37+
/**
38+
* Whether exporting of metrics to this backend is enabled.
39+
*/
40+
private boolean enabled = true;
41+
3742
/**
3843
* Step size (i.e. reporting frequency) to use.
3944
*/
@@ -60,4 +65,12 @@ public void setMode(CountingMode mode) {
6065
this.mode = mode;
6166
}
6267

68+
public boolean isEnabled() {
69+
return this.enabled;
70+
}
71+
72+
public void setEnabled(boolean enabled) {
73+
this.enabled = enabled;
74+
}
75+
6376
}

0 commit comments

Comments
 (0)