Adapt to latest change in Micrometer 1.1

pull/14353/merge
Stephane Nicoll 6 years ago
parent 12cb478b0d
commit 35752a54d2

@ -29,9 +29,9 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
public class ElasticProperties extends StepRegistryProperties {
/**
* Hosts to export metrics to.
* Host to export metrics to.
*/
private String[] hosts = new String[] { "http://localhost:9200" };
private String host = "http://localhost:9200";
/**
* Index to export metrics to.
@ -64,12 +64,12 @@ public class ElasticProperties extends StepRegistryProperties {
*/
private String password = "";
public String[] getHosts() {
return this.hosts;
public String getHost() {
return this.host;
}
public void setHosts(String[] hosts) {
this.hosts = hosts;
public void setHost(String host) {
this.host = host;
}
public String getIndex() {

@ -33,8 +33,8 @@ class ElasticPropertiesConfigAdapter extends
}
@Override
public String[] hosts() {
return get(ElasticProperties::getHosts, ElasticConfig.super::hosts);
public String host() {
return get(ElasticProperties::getHost, ElasticConfig.super::host);
}
@Override

@ -30,9 +30,9 @@ public class ElasticPropertiesConfigAdapterTests {
@Test
public void whenPropertiesHostsIsSetAdapterHostsReturnsIt() {
ElasticProperties properties = new ElasticProperties();
properties.setHosts(new String[] { "https://elastic.example.com" });
assertThat(new ElasticPropertiesConfigAdapter(properties).hosts())
.isEqualTo(new String[] { "https://elastic.example.com" });
properties.setHost("https://elastic.example.com");
assertThat(new ElasticPropertiesConfigAdapter(properties).host())
.isEqualTo("https://elastic.example.com");
}
@Test

@ -34,7 +34,7 @@ public class ElasticPropertiesTests extends StepRegistryPropertiesTests {
ElasticProperties properties = new ElasticProperties();
ElasticConfig config = ElasticConfig.DEFAULT;
assertStepRegistryDefaultValues(properties, config);
assertThat(properties.getHosts()).isEqualTo(config.hosts());
assertThat(properties.getHost()).isEqualTo(config.host());
assertThat(properties.getIndex()).isEqualTo(config.index());
assertThat(properties.getIndexDateFormat()).isEqualTo(config.indexDateFormat());
assertThat(properties.getPassword()).isEqualTo(config.password());

@ -1422,7 +1422,7 @@ content into your application. Rather, pick only the properties that you need.
management.metrics.export.elastic.batch-size=10000 # Number of measurements per request to use for this backend. If more measurements are found, then multiple requests will be made.
management.metrics.export.elastic.connect-timeout=1s # Connection timeout for requests to this backend.
management.metrics.export.elastic.enabled=true # Whether exporting of metrics to this backend is enabled.
management.metrics.export.elastic.hosts=http://localhost:9200 # Hosts to export metrics to.
management.metrics.export.elastic.host=http://localhost:9200 # Host to export metrics to.
management.metrics.export.elastic.index=metrics # Index to export metrics to.
management.metrics.export.elastic.index-date-format=yyyy-MM # Index date format used for rolling indices. Appended to the index name, preceded by a '-'.
management.metrics.export.elastic.num-threads=2 # Number of threads to use with the metrics publishing scheduler.

@ -1490,7 +1490,7 @@ using the following property:
[source,properties,indent=0]
----
management.metrics.export.elastic.hosts=http://elastic.example.com:8086
management.metrics.export.elastic.host=http://elastic.example.com:8086
----

Loading…
Cancel
Save