Fix AtlasProperties hierarchy

This commit fixes the AtlasProperties hierarchy so that it no longer is
a StepRegistryProperties. The AtlasConfig on the Micrometer side of
things does not share the common config hierarchy either and some
properties have different default and lifecycle.

Closes gh-20843
This commit is contained in:
Stephane Nicoll 2020-04-05 14:57:25 +02:00
parent d7c376adf6
commit 4641794fb5

View File

@ -18,7 +18,6 @@ package org.springframework.boot.actuate.autoconfigure.metrics.export.atlas;
import java.time.Duration;
import org.springframework.boot.actuate.autoconfigure.metrics.export.properties.StepRegistryProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
@ -30,13 +29,39 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @since 2.0.0
*/
@ConfigurationProperties(prefix = "management.metrics.export.atlas")
public class AtlasProperties extends StepRegistryProperties {
public class AtlasProperties {
/**
* Step size (i.e. reporting frequency) to use.
*/
private Duration step = Duration.ofMinutes(1);
/**
* Whether exporting of metrics to this backend is enabled.
*/
private boolean enabled = true;
/**
* Connection timeout for requests to this backend.
*/
private Duration connectTimeout = Duration.ofSeconds(1);
/**
* Read timeout for requests to this backend.
*/
private Duration readTimeout = Duration.ofSeconds(10);
/**
* Number of threads to use with the metrics publishing scheduler.
*/
private Integer numThreads = 4;
/**
* Number of measurements per request to use for this backend. If more measurements
* are found, then multiple requests will be made.
*/
private Integer batchSize = 10000;
/**
* URI of the Atlas server.
*/
@ -73,16 +98,54 @@ public class AtlasProperties extends StepRegistryProperties {
*/
private String evalUri = "http://localhost:7101/lwc/api/v1/evaluate";
@Override
public Duration getStep() {
return this.step;
}
public void setStep(Duration step) {
this.step = step;
}
public boolean isEnabled() {
return this.enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public Duration getConnectTimeout() {
return this.connectTimeout;
}
public void setConnectTimeout(Duration connectTimeout) {
this.connectTimeout = connectTimeout;
}
public Duration getReadTimeout() {
return this.readTimeout;
}
public void setReadTimeout(Duration readTimeout) {
this.readTimeout = readTimeout;
}
public Integer getNumThreads() {
return this.numThreads;
}
@Override
public void setNumThreads(Integer numThreads) {
this.numThreads = numThreads;
}
public Integer getBatchSize() {
return this.batchSize;
}
public void setBatchSize(Integer batchSize) {
this.batchSize = batchSize;
}
public String getUri() {
return this.uri;
}