From fe63342f52787cdfdd26191f1f05d92495462a86 Mon Sep 17 00:00:00 2001 From: artsiom Date: Thu, 18 Oct 2018 13:43:42 +0300 Subject: [PATCH 1/2] Handle StepRegistry connect/read timeout deprecation See gh-14886 --- ...AppOpticsMetricsExportAutoConfiguration.java | 10 ++++++++-- .../DatadogMetricsExportAutoConfiguration.java | 10 ++++++++-- ...DynatraceMetricsExportAutoConfiguration.java | 10 ++++++++-- .../ElasticMetricsExportAutoConfiguration.java | 10 ++++++++-- .../HumioMetricsExportAutoConfiguration.java | 12 ++++++++++-- .../InfluxMetricsExportAutoConfiguration.java | 13 ++++++++++--- .../KairosMetricsExportAutoConfiguration.java | 13 ++++++++++--- .../NewRelicMetricsExportAutoConfiguration.java | 11 +++++++++-- .../StepRegistryPropertiesConfigAdapter.java | 11 +---------- ...WavefrontMetricsExportAutoConfiguration.java | 10 ++++++++-- .../HumioPropertiesConfigAdapterTests.java | 9 --------- ...tepRegistryPropertiesConfigAdapterTests.java | 17 +---------------- 12 files changed, 81 insertions(+), 55 deletions(-) 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..1aa3f58732 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 @@ -59,8 +61,12 @@ public class AppOpticsMetricsExportAutoConfiguration { @Bean @ConditionalOnMissingBean public AppOpticsMeterRegistry appOpticsMeterRegistry(AppOpticsConfig config, - Clock clock) { - return new AppOpticsMeterRegistry(config, clock); + Clock clock, AppOpticsProperties appOpticsProperties) { + return AppOpticsMeterRegistry.builder(config).clock(clock) + .httpClient(new HttpUrlConnectionSender( + appOpticsProperties.getConnectTimeout(), + appOpticsProperties.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..7cb91d9582 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 @@ -59,8 +61,12 @@ public class DatadogMetricsExportAutoConfiguration { @Bean @ConditionalOnMissingBean public DatadogMeterRegistry datadogMeterRegistry(DatadogConfig datadogConfig, - Clock clock) { - return new DatadogMeterRegistry(datadogConfig, clock); + Clock clock, DatadogProperties datadogProperties) { + return DatadogMeterRegistry.builder(datadogConfig).clock(clock) + .httpClient( + new HttpUrlConnectionSender(datadogProperties.getConnectTimeout(), + datadogProperties.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..394d42b266 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 @@ -59,8 +61,12 @@ public class DynatraceMetricsExportAutoConfiguration { @Bean @ConditionalOnMissingBean public DynatraceMeterRegistry dynatraceMeterRegistry(DynatraceConfig dynatraceConfig, - Clock clock) { - return new DynatraceMeterRegistry(dynatraceConfig, clock); + Clock clock, DynatraceProperties dynatraceProperties) { + return DynatraceMeterRegistry.builder(dynatraceConfig).clock(clock) + .httpClient(new HttpUrlConnectionSender( + dynatraceProperties.getConnectTimeout(), + dynatraceProperties.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..2478e3e370 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 @@ -59,8 +61,12 @@ public class ElasticMetricsExportAutoConfiguration { @Bean @ConditionalOnMissingBean public ElasticMeterRegistry elasticMeterRegistry(ElasticConfig elasticConfig, - Clock clock) { - return new ElasticMeterRegistry(elasticConfig, clock); + Clock clock, ElasticProperties elasticProperties) { + return ElasticMeterRegistry.builder(elasticConfig).clock(clock) + .httpClient( + new HttpUrlConnectionSender(elasticProperties.getConnectTimeout(), + elasticProperties.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..135c5620a1 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 @@ -58,8 +60,14 @@ public class HumioMetricsExportAutoConfiguration { @Bean @ConditionalOnMissingBean - public HumioMeterRegistry humioMeterRegistry(HumioConfig humioConfig, Clock clock) { - return new HumioMeterRegistry(humioConfig, clock); + public HumioMeterRegistry humioMeterRegistry(HumioConfig humioConfig, Clock clock, + HumioProperties humioProperties) { + return HumioMeterRegistry.builder(humioConfig).clock(clock) + .httpClient( + new HttpUrlConnectionSender(humioProperties.getConnectTimeout(), + humioProperties.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..15b3ef6804 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 @@ -58,9 +60,14 @@ public class InfluxMetricsExportAutoConfiguration { @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(influxProperties.getConnectTimeout(), + influxProperties.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..9000902bb4 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 @@ -58,9 +60,14 @@ public class KairosMetricsExportAutoConfiguration { @Bean @ConditionalOnMissingBean - public KairosMeterRegistry kairosMeterRegistry(KairosConfig kairosConfig, - Clock clock) { - return new KairosMeterRegistry(kairosConfig, clock); + public KairosMeterRegistry kairosMeterRegistry(KairosConfig kairosConfig, Clock clock, + KairosProperties kairosProperties) { + return KairosMeterRegistry.builder(kairosConfig).clock(clock) + .httpClient( + new HttpUrlConnectionSender(kairosProperties.getConnectTimeout(), + kairosProperties.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..4a3e0e285f 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 @@ -60,8 +62,13 @@ public class NewRelicMetricsExportAutoConfiguration { @Bean @ConditionalOnMissingBean public NewRelicMeterRegistry newRelicMeterRegistry(NewRelicConfig newRelicConfig, - Clock clock) { - return new NewRelicMeterRegistry(newRelicConfig, clock); + Clock clock, NewRelicProperties newRelicProperties) { + return NewRelicMeterRegistry.builder(newRelicConfig).clock(clock) + .httpClient(new HttpUrlConnectionSender( + newRelicProperties.getConnectTimeout(), + newRelicProperties.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

Date: Mon, 29 Oct 2018 21:11:11 +0000 Subject: [PATCH 2/2] Polish "Handle StepRegistry connect/read timeout deprecation" Closes gh-14886 --- ...ppOpticsMetricsExportAutoConfiguration.java | 18 ++++++++++++------ .../DatadogMetricsExportAutoConfiguration.java | 16 +++++++++++----- ...ynatraceMetricsExportAutoConfiguration.java | 18 ++++++++++++------ .../ElasticMetricsExportAutoConfiguration.java | 16 +++++++++++----- .../HumioMetricsExportAutoConfiguration.java | 17 +++++++++++------ .../InfluxMetricsExportAutoConfiguration.java | 14 ++++++++++---- .../KairosMetricsExportAutoConfiguration.java | 18 ++++++++++++------ ...NewRelicMetricsExportAutoConfiguration.java | 18 ++++++++++++------ ...avefrontMetricsExportAutoConfiguration.java | 18 ++++++++++++------ 9 files changed, 103 insertions(+), 50 deletions(-) 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 1aa3f58732..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 @@ -52,20 +52,26 @@ 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, AppOpticsProperties appOpticsProperties) { + Clock clock) { return AppOpticsMeterRegistry.builder(config).clock(clock) - .httpClient(new HttpUrlConnectionSender( - appOpticsProperties.getConnectTimeout(), - appOpticsProperties.getReadTimeout())) + .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 7cb91d9582..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 @@ -52,20 +52,26 @@ 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, DatadogProperties datadogProperties) { + Clock clock) { return DatadogMeterRegistry.builder(datadogConfig).clock(clock) .httpClient( - new HttpUrlConnectionSender(datadogProperties.getConnectTimeout(), - datadogProperties.getReadTimeout())) + 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 394d42b266..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 @@ -52,20 +52,26 @@ 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, DynatraceProperties dynatraceProperties) { + Clock clock) { return DynatraceMeterRegistry.builder(dynatraceConfig).clock(clock) - .httpClient(new HttpUrlConnectionSender( - dynatraceProperties.getConnectTimeout(), - dynatraceProperties.getReadTimeout())) + .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 2478e3e370..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 @@ -52,20 +52,26 @@ 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, ElasticProperties elasticProperties) { + Clock clock) { return ElasticMeterRegistry.builder(elasticConfig).clock(clock) .httpClient( - new HttpUrlConnectionSender(elasticProperties.getConnectTimeout(), - elasticProperties.getReadTimeout())) + 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 135c5620a1..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 @@ -52,20 +52,25 @@ 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, - HumioProperties humioProperties) { + public HumioMeterRegistry humioMeterRegistry(HumioConfig humioConfig, Clock clock) { return HumioMeterRegistry.builder(humioConfig).clock(clock) .httpClient( - new HttpUrlConnectionSender(humioProperties.getConnectTimeout(), - humioProperties.getReadTimeout())) + 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 15b3ef6804..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 @@ -52,10 +52,16 @@ 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 @@ -64,8 +70,8 @@ public class InfluxMetricsExportAutoConfiguration { InfluxProperties influxProperties) { return InfluxMeterRegistry.builder(influxConfig).clock(clock) .httpClient( - new HttpUrlConnectionSender(influxProperties.getConnectTimeout(), - influxProperties.getReadTimeout())) + 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 9000902bb4..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 @@ -52,20 +52,26 @@ 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, - KairosProperties kairosProperties) { + public KairosMeterRegistry kairosMeterRegistry(KairosConfig kairosConfig, + Clock clock) { return KairosMeterRegistry.builder(kairosConfig).clock(clock) .httpClient( - new HttpUrlConnectionSender(kairosProperties.getConnectTimeout(), - kairosProperties.getReadTimeout())) + 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 4a3e0e285f..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 @@ -53,20 +53,26 @@ 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, NewRelicProperties newRelicProperties) { + Clock clock) { return NewRelicMeterRegistry.builder(newRelicConfig).clock(clock) - .httpClient(new HttpUrlConnectionSender( - newRelicProperties.getConnectTimeout(), - newRelicProperties.getReadTimeout())) + .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/wavefront/WavefrontMetricsExportAutoConfiguration.java b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/wavefront/WavefrontMetricsExportAutoConfiguration.java index fe7de604f5..d5a59e1c86 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/wavefront/WavefrontMetricsExportAutoConfiguration.java +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/src/main/java/org/springframework/boot/actuate/autoconfigure/metrics/export/wavefront/WavefrontMetricsExportAutoConfiguration.java @@ -52,20 +52,26 @@ import org.springframework.context.annotation.Configuration; @EnableConfigurationProperties(WavefrontProperties.class) public class WavefrontMetricsExportAutoConfiguration { + private final WavefrontProperties properties; + + public WavefrontMetricsExportAutoConfiguration(WavefrontProperties properties) { + this.properties = properties; + } + @Bean @ConditionalOnMissingBean - public WavefrontConfig wavefrontConfig(WavefrontProperties props) { - return new WavefrontPropertiesConfigAdapter(props); + public WavefrontConfig wavefrontConfig() { + return new WavefrontPropertiesConfigAdapter(this.properties); } @Bean @ConditionalOnMissingBean public WavefrontMeterRegistry wavefrontMeterRegistry(WavefrontConfig wavefrontConfig, - Clock clock, WavefrontProperties wavefrontProperties) { + Clock clock) { return WavefrontMeterRegistry.builder(wavefrontConfig).clock(clock) - .httpClient(new HttpUrlConnectionSender( - wavefrontProperties.getConnectTimeout(), - wavefrontProperties.getReadTimeout())) + .httpClient( + new HttpUrlConnectionSender(this.properties.getConnectTimeout(), + this.properties.getReadTimeout())) .build(); }