From df033ef6e360b32f54670491134530001cf60f69 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Fri, 21 Jul 2023 17:25:17 +0100 Subject: [PATCH] Add missing management.metrics.export.wavefront properties Closes gh-36498 --- .../export/wavefront/WavefrontProperties.java | 41 ++++++++++++++++++- .../WavefrontPropertiesConfigAdapter.java | 17 +++++++- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/wavefront/WavefrontProperties.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/wavefront/WavefrontProperties.java index b99706c348a0..1894b932f219 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/wavefront/WavefrontProperties.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/wavefront/WavefrontProperties.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. @@ -57,6 +57,21 @@ public class WavefrontProperties extends PushRegistryProperties { */ 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 = false; + + /** + * Whether to report histogram distributions aggregated into day intervals. + */ + private boolean reportDayDistribution = false; + private final Sender sender = new Sender(); public URI getUri() { @@ -95,6 +110,30 @@ public Sender getSender() { return this.sender; } + 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; + } + public static class Sender { /** 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 22b0716479c1..a294de926b42 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-2020 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. @@ -63,6 +63,21 @@ public String globalPrefix() { return get(WavefrontProperties::getGlobalPrefix, WavefrontConfig.super::globalPrefix); } + @Override + public boolean reportMinuteDistribution() { + return get(WavefrontProperties::isReportMinuteDistribution, WavefrontConfig.super::reportMinuteDistribution); + } + + @Override + public boolean reportHourDistribution() { + return get(WavefrontProperties::isReportHourDistribution, WavefrontConfig.super::reportHourDistribution); + } + + @Override + public boolean reportDayDistribution() { + return get(WavefrontProperties::isReportDayDistribution, WavefrontConfig.super::reportDayDistribution); + } + private String getUriAsString(WavefrontProperties properties) { return (properties.getUri() != null) ? properties.getUri().toString() : null; }