Merge branch '3.1.x'

Closes gh-36557
pull/36565/head
Andy Wilkinson 1 year ago
commit 0f110a5f5b

@ -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);
}
}

@ -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;
}
}
}

@ -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();
}
}

@ -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());
}
}

Loading…
Cancel
Save