Skip to content

Commit 45624c0

Browse files
committed
Merge branch '2.7.x' into 3.0.x
Closes gh-36555
2 parents 826bad5 + aae8665 commit 45624c0

File tree

4 files changed

+81
-3
lines changed

4 files changed

+81
-3
lines changed

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2023 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.
@@ -69,4 +69,19 @@ public String globalPrefix() {
6969
return get(Export::getGlobalPrefix, WavefrontConfig.super::globalPrefix);
7070
}
7171

72+
@Override
73+
public boolean reportMinuteDistribution() {
74+
return get(Export::isReportMinuteDistribution, WavefrontConfig.super::reportMinuteDistribution);
75+
}
76+
77+
@Override
78+
public boolean reportHourDistribution() {
79+
return get(Export::isReportHourDistribution, WavefrontConfig.super::reportHourDistribution);
80+
}
81+
82+
@Override
83+
public boolean reportDayDistribution() {
84+
return get(Export::isReportDayDistribution, WavefrontConfig.super::reportDayDistribution);
85+
}
86+
7287
}

spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/wavefront/WavefrontProperties.java

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,21 @@ public static class Export extends PushRegistryProperties {
303303
*/
304304
private String globalPrefix;
305305

306+
/**
307+
* Whether to report histogram distributions aggregated into minute intervals.
308+
*/
309+
private boolean reportMinuteDistribution = true;
310+
311+
/**
312+
* Whether to report histogram distributions aggregated into hour intervals.
313+
*/
314+
private boolean reportHourDistribution;
315+
316+
/**
317+
* Whether to report histogram distributions aggregated into day intervals.
318+
*/
319+
private boolean reportDayDistribution;
320+
306321
public String getGlobalPrefix() {
307322
return this.globalPrefix;
308323
}
@@ -327,6 +342,30 @@ public void setBatchSize(Integer batchSize) {
327342
throw new UnsupportedOperationException("Use Sender.setBatchSize(int) instead");
328343
}
329344

345+
public boolean isReportMinuteDistribution() {
346+
return this.reportMinuteDistribution;
347+
}
348+
349+
public void setReportMinuteDistribution(boolean reportMinuteDistribution) {
350+
this.reportMinuteDistribution = reportMinuteDistribution;
351+
}
352+
353+
public boolean isReportHourDistribution() {
354+
return this.reportHourDistribution;
355+
}
356+
357+
public void setReportHourDistribution(boolean reportHourDistribution) {
358+
this.reportHourDistribution = reportHourDistribution;
359+
}
360+
361+
public boolean isReportDayDistribution() {
362+
return this.reportDayDistribution;
363+
}
364+
365+
public void setReportDayDistribution(boolean reportDayDistribution) {
366+
this.reportDayDistribution = reportDayDistribution;
367+
}
368+
330369
}
331370

332371
}

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/metrics/export/wavefront/WavefrontPropertiesConfigAdapterTests.java

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2023 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.
@@ -82,4 +82,25 @@ void whenPropertiesSourceIsSetAdapterSourceReturnsIt() {
8282
assertThat(new WavefrontPropertiesConfigAdapter(properties).source()).isEqualTo("DESKTOP-GA5");
8383
}
8484

85+
@Test
86+
void whenPropertiesReportMinuteDistributionIsSetAdapterReportMinuteDistributionReturnsIt() {
87+
Export properties = createProperties();
88+
properties.setReportMinuteDistribution(false);
89+
assertThat(createConfigAdapter(properties).reportMinuteDistribution()).isFalse();
90+
}
91+
92+
@Test
93+
void whenPropertiesReportHourDistributionIsSetAdapterReportHourDistributionReturnsIt() {
94+
Export properties = createProperties();
95+
properties.setReportHourDistribution(true);
96+
assertThat(createConfigAdapter(properties).reportHourDistribution()).isTrue();
97+
}
98+
99+
@Test
100+
void whenPropertiesReportDayDistributionIsSetAdapterReportDayDistributionReturnsIt() {
101+
Export properties = createProperties();
102+
properties.setReportDayDistribution(true);
103+
assertThat(createConfigAdapter(properties).reportDayDistribution()).isTrue();
104+
}
105+
85106
}

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/wavefront/WavefrontPropertiesMetricsExportTests.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2023 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.
@@ -39,6 +39,9 @@ void defaultValuesAreConsistent() {
3939
assertThat(properties.getReadTimeout()).isEqualTo(config.readTimeout());
4040
assertThat(properties.getStep()).isEqualTo(config.step());
4141
assertThat(properties.isEnabled()).isEqualTo(config.enabled());
42+
assertThat(properties.isReportMinuteDistribution()).isEqualTo(config.reportMinuteDistribution());
43+
assertThat(properties.isReportHourDistribution()).isEqualTo(config.reportHourDistribution());
44+
assertThat(properties.isReportDayDistribution()).isEqualTo(config.reportDayDistribution());
4245
}
4346

4447
}

0 commit comments

Comments
 (0)