diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/appoptics/AppOpticsMetricsExportAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/appoptics/AppOpticsMetricsExportAutoConfiguration.java index 1409265e96..b2e73f40c9 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/appoptics/AppOpticsMetricsExportAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/appoptics/AppOpticsMetricsExportAutoConfiguration.java @@ -19,6 +19,7 @@ package org.springframework.boot.actuate.autoconfigure.metrics.export.appoptics; import io.micrometer.appoptics.AppOpticsConfig; import io.micrometer.appoptics.AppOpticsMeterRegistry; import io.micrometer.core.instrument.Clock; +import io.micrometer.core.ipc.http.HttpUrlConnectionSender; import org.springframework.boot.actuate.autoconfigure.metrics.CompositeMeterRegistryAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration; @@ -38,6 +39,7 @@ import org.springframework.context.annotation.Configuration; * {@link EnableAutoConfiguration Auto-configuration} for exporting metrics to AppOptics. * * @author Stephane Nicoll + * @author Artsiom Yudovin * @since 2.1.0 */ @Configuration @@ -50,17 +52,27 @@ import org.springframework.context.annotation.Configuration; @EnableConfigurationProperties(AppOpticsProperties.class) public class AppOpticsMetricsExportAutoConfiguration { + private final AppOpticsProperties properties; + + public AppOpticsMetricsExportAutoConfiguration(AppOpticsProperties properties) { + this.properties = properties; + } + @Bean @ConditionalOnMissingBean - public AppOpticsConfig appOpticsConfig(AppOpticsProperties appOpticsProperties) { - return new AppOpticsPropertiesConfigAdapter(appOpticsProperties); + public AppOpticsConfig appOpticsConfig() { + return new AppOpticsPropertiesConfigAdapter(this.properties); } @Bean @ConditionalOnMissingBean public AppOpticsMeterRegistry appOpticsMeterRegistry(AppOpticsConfig config, Clock clock) { - return new AppOpticsMeterRegistry(config, clock); + return AppOpticsMeterRegistry.builder(config).clock(clock) + .httpClient( + new HttpUrlConnectionSender(this.properties.getConnectTimeout(), + this.properties.getReadTimeout())) + .build(); } } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/datadog/DatadogMetricsExportAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/datadog/DatadogMetricsExportAutoConfiguration.java index 3a6c36a8c0..54e4813f35 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/datadog/DatadogMetricsExportAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/datadog/DatadogMetricsExportAutoConfiguration.java @@ -17,6 +17,7 @@ package org.springframework.boot.actuate.autoconfigure.metrics.export.datadog; import io.micrometer.core.instrument.Clock; +import io.micrometer.core.ipc.http.HttpUrlConnectionSender; import io.micrometer.datadog.DatadogConfig; import io.micrometer.datadog.DatadogMeterRegistry; @@ -38,6 +39,7 @@ import org.springframework.context.annotation.Configuration; * {@link EnableAutoConfiguration Auto-configuration} for exporting metrics to Datadog. * * @author Jon Schneider + * @author Artsiom Yudovin * @since 2.0.0 */ @Configuration @@ -50,17 +52,27 @@ import org.springframework.context.annotation.Configuration; @EnableConfigurationProperties(DatadogProperties.class) public class DatadogMetricsExportAutoConfiguration { + private final DatadogProperties properties; + + public DatadogMetricsExportAutoConfiguration(DatadogProperties properties) { + this.properties = properties; + } + @Bean @ConditionalOnMissingBean - public DatadogConfig datadogConfig(DatadogProperties datadogProperties) { - return new DatadogPropertiesConfigAdapter(datadogProperties); + public DatadogConfig datadogConfig() { + return new DatadogPropertiesConfigAdapter(this.properties); } @Bean @ConditionalOnMissingBean public DatadogMeterRegistry datadogMeterRegistry(DatadogConfig datadogConfig, Clock clock) { - return new DatadogMeterRegistry(datadogConfig, clock); + return DatadogMeterRegistry.builder(datadogConfig).clock(clock) + .httpClient( + new HttpUrlConnectionSender(this.properties.getConnectTimeout(), + this.properties.getReadTimeout())) + .build(); } } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/dynatrace/DynatraceMetricsExportAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/dynatrace/DynatraceMetricsExportAutoConfiguration.java index e9d28ae3f0..79d84511ab 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/dynatrace/DynatraceMetricsExportAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/dynatrace/DynatraceMetricsExportAutoConfiguration.java @@ -17,6 +17,7 @@ package org.springframework.boot.actuate.autoconfigure.metrics.export.dynatrace; import io.micrometer.core.instrument.Clock; +import io.micrometer.core.ipc.http.HttpUrlConnectionSender; import io.micrometer.dynatrace.DynatraceConfig; import io.micrometer.dynatrace.DynatraceMeterRegistry; @@ -38,6 +39,7 @@ import org.springframework.context.annotation.Configuration; * {@link EnableAutoConfiguration Auto-configuration} for exporting metrics to Dynatrace. * * @author Andy Wilkinson + * @author Artsiom Yudovin * @since 2.1.0 */ @Configuration @@ -50,17 +52,27 @@ import org.springframework.context.annotation.Configuration; @EnableConfigurationProperties(DynatraceProperties.class) public class DynatraceMetricsExportAutoConfiguration { + private final DynatraceProperties properties; + + public DynatraceMetricsExportAutoConfiguration(DynatraceProperties properties) { + this.properties = properties; + } + @Bean @ConditionalOnMissingBean - public DynatraceConfig dynatraceConfig(DynatraceProperties dynatraceProperties) { - return new DynatracePropertiesConfigAdapter(dynatraceProperties); + public DynatraceConfig dynatraceConfig() { + return new DynatracePropertiesConfigAdapter(this.properties); } @Bean @ConditionalOnMissingBean public DynatraceMeterRegistry dynatraceMeterRegistry(DynatraceConfig dynatraceConfig, Clock clock) { - return new DynatraceMeterRegistry(dynatraceConfig, clock); + return DynatraceMeterRegistry.builder(dynatraceConfig).clock(clock) + .httpClient( + new HttpUrlConnectionSender(this.properties.getConnectTimeout(), + this.properties.getReadTimeout())) + .build(); } } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticMetricsExportAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticMetricsExportAutoConfiguration.java index 3d635a4643..7d45e0a9cf 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticMetricsExportAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/elastic/ElasticMetricsExportAutoConfiguration.java @@ -17,6 +17,7 @@ package org.springframework.boot.actuate.autoconfigure.metrics.export.elastic; import io.micrometer.core.instrument.Clock; +import io.micrometer.core.ipc.http.HttpUrlConnectionSender; import io.micrometer.elastic.ElasticConfig; import io.micrometer.elastic.ElasticMeterRegistry; @@ -38,6 +39,7 @@ import org.springframework.context.annotation.Configuration; * {@link EnableAutoConfiguration Auto-configuration} for exporting metrics to Elastic. * * @author Andy Wilkinson + * @author Artsiom Yudovin * @since 2.1.0 */ @Configuration @@ -50,17 +52,27 @@ import org.springframework.context.annotation.Configuration; @EnableConfigurationProperties(ElasticProperties.class) public class ElasticMetricsExportAutoConfiguration { + private final ElasticProperties properties; + + public ElasticMetricsExportAutoConfiguration(ElasticProperties properties) { + this.properties = properties; + } + @Bean @ConditionalOnMissingBean - public ElasticConfig elasticConfig(ElasticProperties elasticProperties) { - return new ElasticPropertiesConfigAdapter(elasticProperties); + public ElasticConfig elasticConfig() { + return new ElasticPropertiesConfigAdapter(this.properties); } @Bean @ConditionalOnMissingBean public ElasticMeterRegistry elasticMeterRegistry(ElasticConfig elasticConfig, Clock clock) { - return new ElasticMeterRegistry(elasticConfig, clock); + return ElasticMeterRegistry.builder(elasticConfig).clock(clock) + .httpClient( + new HttpUrlConnectionSender(this.properties.getConnectTimeout(), + this.properties.getReadTimeout())) + .build(); } } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/humio/HumioMetricsExportAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/humio/HumioMetricsExportAutoConfiguration.java index 3d173182e6..36ce667bd7 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/humio/HumioMetricsExportAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/humio/HumioMetricsExportAutoConfiguration.java @@ -17,6 +17,7 @@ package org.springframework.boot.actuate.autoconfigure.metrics.export.humio; import io.micrometer.core.instrument.Clock; +import io.micrometer.core.ipc.http.HttpUrlConnectionSender; import io.micrometer.humio.HumioConfig; import io.micrometer.humio.HumioMeterRegistry; @@ -38,6 +39,7 @@ import org.springframework.context.annotation.Configuration; * {@link EnableAutoConfiguration Auto-configuration} for exporting metrics to Humio. * * @author Andy Wilkinson + * @author Artsiom Yudovin * @since 2.1.0 */ @Configuration @@ -50,16 +52,27 @@ import org.springframework.context.annotation.Configuration; @EnableConfigurationProperties(HumioProperties.class) public class HumioMetricsExportAutoConfiguration { + private final HumioProperties properties; + + public HumioMetricsExportAutoConfiguration(HumioProperties properties) { + this.properties = properties; + } + @Bean @ConditionalOnMissingBean - public HumioConfig humioConfig(HumioProperties humioProperties) { - return new HumioPropertiesConfigAdapter(humioProperties); + public HumioConfig humioConfig() { + return new HumioPropertiesConfigAdapter(this.properties); } @Bean @ConditionalOnMissingBean public HumioMeterRegistry humioMeterRegistry(HumioConfig humioConfig, Clock clock) { - return new HumioMeterRegistry(humioConfig, clock); + return HumioMeterRegistry.builder(humioConfig).clock(clock) + .httpClient( + new HttpUrlConnectionSender(this.properties.getConnectTimeout(), + this.properties.getReadTimeout())) + .build(); + } } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/influx/InfluxMetricsExportAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/influx/InfluxMetricsExportAutoConfiguration.java index fda2346931..48d3f4f785 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/influx/InfluxMetricsExportAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/influx/InfluxMetricsExportAutoConfiguration.java @@ -17,6 +17,7 @@ package org.springframework.boot.actuate.autoconfigure.metrics.export.influx; import io.micrometer.core.instrument.Clock; +import io.micrometer.core.ipc.http.HttpUrlConnectionSender; import io.micrometer.influx.InfluxConfig; import io.micrometer.influx.InfluxMeterRegistry; @@ -38,6 +39,7 @@ import org.springframework.context.annotation.Configuration; * {@link EnableAutoConfiguration Auto-configuration} for exporting metrics to Influx. * * @author Jon Schneider + * @author Artsiom Yudovin * @since 2.0.0 */ @Configuration @@ -50,17 +52,28 @@ import org.springframework.context.annotation.Configuration; @EnableConfigurationProperties(InfluxProperties.class) public class InfluxMetricsExportAutoConfiguration { + private final InfluxProperties properties; + + public InfluxMetricsExportAutoConfiguration(InfluxProperties properties) { + this.properties = properties; + } + @Bean @ConditionalOnMissingBean - public InfluxConfig influxConfig(InfluxProperties influxProperties) { - return new InfluxPropertiesConfigAdapter(influxProperties); + public InfluxConfig influxConfig() { + return new InfluxPropertiesConfigAdapter(this.properties); } @Bean @ConditionalOnMissingBean - public InfluxMeterRegistry influxMeterRegistry(InfluxConfig influxConfig, - Clock clock) { - return new InfluxMeterRegistry(influxConfig, clock); + public InfluxMeterRegistry influxMeterRegistry(InfluxConfig influxConfig, Clock clock, + InfluxProperties influxProperties) { + return InfluxMeterRegistry.builder(influxConfig).clock(clock) + .httpClient( + new HttpUrlConnectionSender(this.properties.getConnectTimeout(), + this.properties.getReadTimeout())) + .build(); + } } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/kairos/KairosMetricsExportAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/kairos/KairosMetricsExportAutoConfiguration.java index d1a6ba9681..d053dad21f 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/kairos/KairosMetricsExportAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/kairos/KairosMetricsExportAutoConfiguration.java @@ -17,6 +17,7 @@ package org.springframework.boot.actuate.autoconfigure.metrics.export.kairos; import io.micrometer.core.instrument.Clock; +import io.micrometer.core.ipc.http.HttpUrlConnectionSender; import io.micrometer.kairos.KairosConfig; import io.micrometer.kairos.KairosMeterRegistry; @@ -38,6 +39,7 @@ import org.springframework.context.annotation.Configuration; * {@link EnableAutoConfiguration Auto-configuration} for exporting metrics to KairosDB. * * @author Stephane Nicoll + * @author Artsiom Yudovin * @since 2.1.0 */ @Configuration @@ -50,17 +52,28 @@ import org.springframework.context.annotation.Configuration; @EnableConfigurationProperties(KairosProperties.class) public class KairosMetricsExportAutoConfiguration { + private final KairosProperties properties; + + public KairosMetricsExportAutoConfiguration(KairosProperties properties) { + this.properties = properties; + } + @Bean @ConditionalOnMissingBean - public KairosConfig kairosConfig(KairosProperties kairosProperties) { - return new KairosPropertiesConfigAdapter(kairosProperties); + public KairosConfig kairosConfig() { + return new KairosPropertiesConfigAdapter(this.properties); } @Bean @ConditionalOnMissingBean public KairosMeterRegistry kairosMeterRegistry(KairosConfig kairosConfig, Clock clock) { - return new KairosMeterRegistry(kairosConfig, clock); + return KairosMeterRegistry.builder(kairosConfig).clock(clock) + .httpClient( + new HttpUrlConnectionSender(this.properties.getConnectTimeout(), + this.properties.getReadTimeout())) + .build(); + } } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/newrelic/NewRelicMetricsExportAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/newrelic/NewRelicMetricsExportAutoConfiguration.java index 97c54a7362..ddb07a8486 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/newrelic/NewRelicMetricsExportAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/newrelic/NewRelicMetricsExportAutoConfiguration.java @@ -17,6 +17,7 @@ package org.springframework.boot.actuate.autoconfigure.metrics.export.newrelic; import io.micrometer.core.instrument.Clock; +import io.micrometer.core.ipc.http.HttpUrlConnectionSender; import io.micrometer.newrelic.NewRelicConfig; import io.micrometer.newrelic.NewRelicMeterRegistry; @@ -39,6 +40,7 @@ import org.springframework.context.annotation.Configuration; * * @author Jon Schneider * @author Andy Wilkinson + * @author Artsiom Yudovin * @since 2.0.0 */ @Configuration @@ -51,17 +53,28 @@ import org.springframework.context.annotation.Configuration; @EnableConfigurationProperties(NewRelicProperties.class) public class NewRelicMetricsExportAutoConfiguration { + private final NewRelicProperties properties; + + public NewRelicMetricsExportAutoConfiguration(NewRelicProperties properties) { + this.properties = properties; + } + @Bean @ConditionalOnMissingBean - public NewRelicConfig newRelicConfig(NewRelicProperties props) { - return new NewRelicPropertiesConfigAdapter(props); + public NewRelicConfig newRelicConfig() { + return new NewRelicPropertiesConfigAdapter(this.properties); } @Bean @ConditionalOnMissingBean public NewRelicMeterRegistry newRelicMeterRegistry(NewRelicConfig newRelicConfig, Clock clock) { - return new NewRelicMeterRegistry(newRelicConfig, clock); + return NewRelicMeterRegistry.builder(newRelicConfig).clock(clock) + .httpClient( + new HttpUrlConnectionSender(this.properties.getConnectTimeout(), + this.properties.getReadTimeout())) + .build(); + } } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/properties/StepRegistryPropertiesConfigAdapter.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/properties/StepRegistryPropertiesConfigAdapter.java index f8e758d7e7..bd6976f367 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/properties/StepRegistryPropertiesConfigAdapter.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/properties/StepRegistryPropertiesConfigAdapter.java @@ -26,6 +26,7 @@ import io.micrometer.core.instrument.step.StepRegistryConfig; * @param the properties type * @author Jon Schneider * @author Phillip Webb + * @author Artsiom Yudovin * @since 2.0.0 */ public abstract class StepRegistryPropertiesConfigAdapter @@ -55,16 +56,6 @@ public abstract class StepRegistryPropertiesConfigAdapter properties used by the tests * @param adapter used by the tests * @author Stephane Nicoll + * @author Artsiom Yudovin */ public abstract class StepRegistryPropertiesConfigAdapterTests

> { @@ -50,22 +51,6 @@ public abstract class StepRegistryPropertiesConfigAdapterTests