Add missing management.metrics.export.wavefront properties
Closes gh-36498
This commit is contained in:
@@ -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;
|
||||
|
||||
/**
|
||||
* Whether to report histogram distributions aggregated into day intervals.
|
||||
*/
|
||||
private boolean reportDayDistribution;
|
||||
|
||||
private final Sender sender = new Sender();
|
||||
|
||||
public URI getUri() {
|
||||
@@ -95,6 +110,30 @@ public class WavefrontProperties extends PushRegistryProperties {
|
||||
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 {
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
@@ -48,6 +48,10 @@ public class WavefrontPropertiesConfigAdapter extends PushRegistryPropertiesConf
|
||||
return get(this::getUriAsString, WavefrontConfig.DEFAULT_DIRECT::uri);
|
||||
}
|
||||
|
||||
private String getUriAsString(WavefrontProperties properties) {
|
||||
return (properties.getUri() != null) ? properties.getUri().toString() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String source() {
|
||||
return get(WavefrontProperties::getSource, WavefrontConfig.super::source);
|
||||
@@ -63,8 +67,19 @@ public class WavefrontPropertiesConfigAdapter extends PushRegistryPropertiesConf
|
||||
return get(WavefrontProperties::getGlobalPrefix, WavefrontConfig.super::globalPrefix);
|
||||
}
|
||||
|
||||
private String getUriAsString(WavefrontProperties properties) {
|
||||
return (properties.getUri() != null) ? properties.getUri().toString() : null;
|
||||
@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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 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.
|
||||
@@ -70,4 +70,25 @@ class WavefrontPropertiesConfigAdapterTests
|
||||
assertThat(createConfigAdapter(properties).globalPrefix()).isEqualTo("test");
|
||||
}
|
||||
|
||||
@Test
|
||||
void whenPropertiesReportMinuteDistributionIsSetAdapterReportMinuteDistributionReturnsIt() {
|
||||
WavefrontProperties properties = createProperties();
|
||||
properties.setReportMinuteDistribution(false);
|
||||
assertThat(createConfigAdapter(properties).reportMinuteDistribution()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void whenPropertiesReportHourDistributionIsSetAdapterReportHourDistributionReturnsIt() {
|
||||
WavefrontProperties properties = createProperties();
|
||||
properties.setReportHourDistribution(true);
|
||||
assertThat(createConfigAdapter(properties).reportHourDistribution()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
void whenPropertiesReportDayDistributionIsSetAdapterReportDayDistributionReturnsIt() {
|
||||
WavefrontProperties properties = createProperties();
|
||||
properties.setReportDayDistribution(true);
|
||||
assertThat(createConfigAdapter(properties).reportDayDistribution()).isTrue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -37,6 +37,9 @@ class WavefrontPropertiesTests extends PushRegistryPropertiesTests {
|
||||
assertStepRegistryDefaultValues(properties, config);
|
||||
assertThat(properties.getUri().toString()).isEqualTo(config.uri());
|
||||
assertThat(properties.getGlobalPrefix()).isEqualTo(config.globalPrefix());
|
||||
assertThat(properties.isReportMinuteDistribution()).isEqualTo(config.reportMinuteDistribution());
|
||||
assertThat(properties.isReportHourDistribution()).isEqualTo(config.reportHourDistribution());
|
||||
assertThat(properties.isReportDayDistribution()).isEqualTo(config.reportDayDistribution());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user