diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/wavefront/WavefrontPropertiesConfigAdapter.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/wavefront/WavefrontPropertiesConfigAdapter.java index 6baf69378f..9ffa626b2b 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/wavefront/WavefrontPropertiesConfigAdapter.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/wavefront/WavefrontPropertiesConfigAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 the original author or authors. + * Copyright 2012-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,4 +69,19 @@ public class WavefrontPropertiesConfigAdapter return get(Export::getGlobalPrefix, WavefrontConfig.super::globalPrefix); } + @Override + public boolean reportMinuteDistribution() { + return get(Export::isReportMinuteDistribution, WavefrontConfig.super::reportMinuteDistribution); + } + + @Override + public boolean reportHourDistribution() { + return get(Export::isReportHourDistribution, WavefrontConfig.super::reportHourDistribution); + } + + @Override + public boolean reportDayDistribution() { + return get(Export::isReportDayDistribution, WavefrontConfig.super::reportDayDistribution); + } + } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/wavefront/WavefrontProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/wavefront/WavefrontProperties.java index 5803ecaaf3..19c66c0071 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/wavefront/WavefrontProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/wavefront/WavefrontProperties.java @@ -318,6 +318,21 @@ public class WavefrontProperties { */ private String globalPrefix; + /** + * Whether to report histogram distributions aggregated into minute intervals. + */ + private boolean reportMinuteDistribution = true; + + /** + * Whether to report histogram distributions aggregated into hour intervals. + */ + private boolean reportHourDistribution; + + /** + * Whether to report histogram distributions aggregated into day intervals. + */ + private boolean reportDayDistribution; + public String getGlobalPrefix() { return this.globalPrefix; } @@ -342,6 +357,30 @@ public class WavefrontProperties { throw new UnsupportedOperationException("Use Sender.setBatchSize(int) instead"); } + public boolean isReportMinuteDistribution() { + return this.reportMinuteDistribution; + } + + public void setReportMinuteDistribution(boolean reportMinuteDistribution) { + this.reportMinuteDistribution = reportMinuteDistribution; + } + + public boolean isReportHourDistribution() { + return this.reportHourDistribution; + } + + public void setReportHourDistribution(boolean reportHourDistribution) { + this.reportHourDistribution = reportHourDistribution; + } + + public boolean isReportDayDistribution() { + return this.reportDayDistribution; + } + + public void setReportDayDistribution(boolean reportDayDistribution) { + this.reportDayDistribution = reportDayDistribution; + } + } } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/wavefront/WavefrontPropertiesConfigAdapterTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/wavefront/WavefrontPropertiesConfigAdapterTests.java index 6660d93199..2281c17bed 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/wavefront/WavefrontPropertiesConfigAdapterTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/wavefront/WavefrontPropertiesConfigAdapterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 the original author or authors. + * Copyright 2012-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -82,4 +82,25 @@ class WavefrontPropertiesConfigAdapterTests extends assertThat(new WavefrontPropertiesConfigAdapter(properties).source()).isEqualTo("DESKTOP-GA5"); } + @Test + void whenPropertiesReportMinuteDistributionIsSetAdapterReportMinuteDistributionReturnsIt() { + Export properties = createProperties(); + properties.setReportMinuteDistribution(false); + assertThat(createConfigAdapter(properties).reportMinuteDistribution()).isFalse(); + } + + @Test + void whenPropertiesReportHourDistributionIsSetAdapterReportHourDistributionReturnsIt() { + Export properties = createProperties(); + properties.setReportHourDistribution(true); + assertThat(createConfigAdapter(properties).reportHourDistribution()).isTrue(); + } + + @Test + void whenPropertiesReportDayDistributionIsSetAdapterReportDayDistributionReturnsIt() { + Export properties = createProperties(); + properties.setReportDayDistribution(true); + assertThat(createConfigAdapter(properties).reportDayDistribution()).isTrue(); + } + } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/wavefront/WavefrontPropertiesMetricsExportTests.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/wavefront/WavefrontPropertiesMetricsExportTests.java index f467aa7c37..1729390809 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/wavefront/WavefrontPropertiesMetricsExportTests.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/wavefront/WavefrontPropertiesMetricsExportTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 the original author or authors. + * Copyright 2012-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,6 +39,9 @@ class WavefrontPropertiesMetricsExportTests { assertThat(properties.getReadTimeout()).isEqualTo(config.readTimeout()); assertThat(properties.getStep()).isEqualTo(config.step()); assertThat(properties.isEnabled()).isEqualTo(config.enabled()); + assertThat(properties.isReportMinuteDistribution()).isEqualTo(config.reportMinuteDistribution()); + assertThat(properties.isReportHourDistribution()).isEqualTo(config.reportHourDistribution()); + assertThat(properties.isReportDayDistribution()).isEqualTo(config.reportDayDistribution()); } }