Expose AppOptics's floorTimes property

Closes gh-20850
This commit is contained in:
Stephane Nicoll 2020-04-06 15:27:57 +02:00
parent 888a81beba
commit f293f6ad9b
4 changed files with 31 additions and 4 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 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.
@ -46,6 +46,12 @@ public class AppOpticsProperties extends StepRegistryProperties {
*/
private String hostTag = "instance";
/**
* Whether to ship a floored time, useful when sending measurements from multiple
* hosts to align them on a given time boundary.
*/
private boolean floorTimes;
/**
* Number of measurements per request to use for this backend. If more measurements
* are found, then multiple requests will be made.
@ -81,6 +87,14 @@ public class AppOpticsProperties extends StepRegistryProperties {
this.hostTag = hostTag;
}
public boolean isFloorTimes() {
return this.floorTimes;
}
public void setFloorTimes(boolean floorTimes) {
this.floorTimes = floorTimes;
}
@Override
public Integer getBatchSize() {
return this.batchSize;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 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.
@ -47,4 +47,9 @@ class AppOpticsPropertiesConfigAdapter extends StepRegistryPropertiesConfigAdapt
return get(AppOpticsProperties::getHostTag, AppOpticsConfig.super::hostTag);
}
@Override
public boolean floorTimes() {
return get(AppOpticsProperties::isFloorTimes, AppOpticsConfig.super::floorTimes);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 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.
@ -61,4 +61,11 @@ class AppOpticsPropertiesConfigAdapterTests
assertThat(createConfigAdapter(properties).hostTag()).isEqualTo("node");
}
@Test
void whenPropertiesFloorTimesIsSetAdapterHostTagReturnsIt() {
AppOpticsProperties properties = createProperties();
properties.setFloorTimes(true);
assertThat(createConfigAdapter(properties).floorTimes()).isTrue();
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2020 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,7 @@ class AppOpticsPropertiesTests extends StepRegistryPropertiesTests {
assertStepRegistryDefaultValues(properties, config);
assertThat(properties.getUri()).isEqualToIgnoringWhitespace(config.uri());
assertThat(properties.getHostTag()).isEqualToIgnoringWhitespace(config.hostTag());
assertThat(properties.isFloorTimes()).isEqualTo(config.floorTimes());
}
}