Skip to content

Commit 24e748d

Browse files
committed
Remove unnecessary entries in additional config metadata
Add the 'enabled' fields directly to the classes instead. Closes gh-30439
1 parent 0ff8119 commit 24e748d

File tree

4 files changed

+42
-21
lines changed

4 files changed

+42
-21
lines changed

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -31,6 +31,11 @@
3131
@ConfigurationProperties(prefix = "management.metrics.export.jmx")
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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -36,6 +36,11 @@
3636
@ConfigurationProperties(prefix = "management.metrics.export.prometheus")
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.
@@ -82,6 +87,14 @@ public void setStep(Duration step) {
8287
this.step = step;
8388
}
8489

90+
public boolean isEnabled() {
91+
return this.enabled;
92+
}
93+
94+
public void setEnabled(boolean enabled) {
95+
this.enabled = enabled;
96+
}
97+
8598
public Pushgateway getPushgateway() {
8699
return this.pushgateway;
87100
}

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -34,6 +34,11 @@
3434
@ConfigurationProperties(prefix = "management.metrics.export.simple")
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
*/
@@ -44,6 +49,14 @@ public class SimpleProperties {
4449
*/
4550
private CountingMode mode = CountingMode.CUMULATIVE;
4651

52+
public boolean isEnabled() {
53+
return this.enabled;
54+
}
55+
56+
public void setEnabled(boolean enabled) {
57+
this.enabled = enabled;
58+
}
59+
4760
public Duration getStep() {
4861
return this.step;
4962
}

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -421,12 +421,6 @@
421421
"level": "error"
422422
}
423423
},
424-
{
425-
"name": "management.metrics.export.jmx.enabled",
426-
"type": "java.lang.Boolean",
427-
"description": "Whether exporting of metrics to JMX is enabled.",
428-
"defaultValue": true
429-
},
430424
{
431425
"name": "management.metrics.export.kairos.num-threads",
432426
"type": "java.lang.Integer",
@@ -444,12 +438,6 @@
444438
"level": "error"
445439
}
446440
},
447-
{
448-
"name": "management.metrics.export.prometheus.enabled",
449-
"type": "java.lang.Boolean",
450-
"description": "Whether exporting of metrics to Prometheus is enabled.",
451-
"defaultValue": true
452-
},
453441
{
454442
"name": "management.metrics.export.prometheus.histogram-flavor",
455443
"defaultValue": "prometheus"
@@ -467,12 +455,6 @@
467455
"level": "error"
468456
}
469457
},
470-
{
471-
"name": "management.metrics.export.simple.enabled",
472-
"type": "java.lang.Boolean",
473-
"description": "Whether, in the absence of any other exporter, exporting of metrics to an in-memory backend is enabled.",
474-
"defaultValue": true
475-
},
476458
{
477459
"name": "management.metrics.export.simple.mode",
478460
"defaultValue": "cumulative"

0 commit comments

Comments
 (0)