From e14a2e33abbd97880f93a6e00344213afe87fe75 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Wed, 9 May 2018 09:12:19 +0100 Subject: [PATCH] Deprecate queue size property for StatsD metrics export Closes gh-13108 --- .../metrics/export/statsd/StatsdProperties.java | 4 ++++ .../metrics/export/statsd/StatsdPropertiesConfigAdapter.java | 1 + .../META-INF/additional-spring-configuration-metadata.json | 5 ++++- .../metrics/export/statsd/StatsdPropertiesTests.java | 1 - 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/statsd/StatsdProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/statsd/StatsdProperties.java index f9b3cd9a2b74..3169348aa9ba 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/statsd/StatsdProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/statsd/StatsdProperties.java @@ -21,6 +21,7 @@ import io.micrometer.statsd.StatsdFlavor; import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.boot.context.properties.DeprecatedConfigurationProperty; /** * {@link ConfigurationProperties} for configuring StatsD metrics export. @@ -122,10 +123,13 @@ public void setPollingFrequency(Duration pollingFrequency) { this.pollingFrequency = pollingFrequency; } + @Deprecated + @DeprecatedConfigurationProperty(reason = "No longer configurable and an unbounded queue will always be used") public Integer getQueueSize() { return this.queueSize; } + @Deprecated public void setQueueSize(Integer queueSize) { this.queueSize = queueSize; } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/statsd/StatsdPropertiesConfigAdapter.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/statsd/StatsdPropertiesConfigAdapter.java index e6875d06e28b..c62b2c9b84ca 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/statsd/StatsdPropertiesConfigAdapter.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/statsd/StatsdPropertiesConfigAdapter.java @@ -74,6 +74,7 @@ public Duration pollingFrequency() { } @Override + @Deprecated public int queueSize() { return get(StatsdProperties::getQueueSize, StatsdConfig.super::queueSize); } 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 659b89f13c36..915d0ba40eee 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 @@ -280,7 +280,10 @@ }, { "name": "management.metrics.export.statsd.queue-size", - "defaultValue": 2147483647 + "defaultValue": 2147483647, + "deprecation": { + "level": "error" + } }, { "name": "management.trace.http.enabled", diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/statsd/StatsdPropertiesTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/statsd/StatsdPropertiesTests.java index 69fea27db5d8..9f1675c66f49 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/statsd/StatsdPropertiesTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/statsd/StatsdPropertiesTests.java @@ -38,7 +38,6 @@ public void defaultValuesAreConsistent() { assertThat(properties.getPort()).isEqualTo(config.port()); assertThat(properties.getMaxPacketLength()).isEqualTo(config.maxPacketLength()); assertThat(properties.getPollingFrequency()).isEqualTo(config.pollingFrequency()); - assertThat(properties.getQueueSize()).isEqualTo(config.queueSize()); assertThat(properties.isPublishUnchangedMeters()) .isEqualTo(config.publishUnchangedMeters()); }