Skip to content

Commit

Permalink
Merge branch '3.0.x' into 3.1.x
Browse files Browse the repository at this point in the history
Closes gh-36556
  • Loading branch information
wilkinsona committed Jul 25, 2023
2 parents 5d1b234 + 45624c0 commit 22fa904
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -69,4 +69,19 @@ public String globalPrefix() {
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);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,21 @@ public static class Export 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;

/**
* Whether to report histogram distributions aggregated into day intervals.
*/
private boolean reportDayDistribution;

public String getGlobalPrefix() {
return this.globalPrefix;
}
Expand All @@ -342,6 +357,30 @@ public void setBatchSize(Integer batchSize) {
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;
}

}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -82,4 +82,25 @@ void whenPropertiesSourceIsSetAdapterSourceReturnsIt() {
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();
}

}
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -39,6 +39,9 @@ void defaultValuesAreConsistent() {
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());
}

}

0 comments on commit 22fa904

Please sign in to comment.