diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricExportAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricExportAutoConfiguration.java index 1531b6b9c6..eb4b71f462 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricExportAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/MetricExportAutoConfiguration.java @@ -30,7 +30,7 @@ import org.springframework.boot.actuate.metrics.export.MetricExporters; import org.springframework.boot.actuate.metrics.reader.CompositeMetricReader; import org.springframework.boot.actuate.metrics.reader.MetricReader; import org.springframework.boot.actuate.metrics.statsd.StatsdMetricWriter; -import org.springframework.boot.actuate.metrics.writer.MetricWriter; +import org.springframework.boot.actuate.metrics.writer.GaugeWriter; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; @@ -67,7 +67,7 @@ public class MetricExportAutoConfiguration { @Autowired(required = false) @ExportMetricWriter - private Map writers = Collections.emptyMap(); + private Map writers = Collections.emptyMap(); @Autowired(required = false) private Map exporters = Collections.emptyMap(); @@ -75,7 +75,7 @@ public class MetricExportAutoConfiguration { @Bean @ConditionalOnMissingBean(name = "metricWritersMetricExporter") public SchedulingConfigurer metricWritersMetricExporter() { - Map writers = new HashMap(); + Map writers = new HashMap(); MetricReader reader = this.endpointReader; if (reader == null && !CollectionUtils.isEmpty(this.readers)) { reader = new CompositeMetricReader( diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/MetricExporters.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/MetricExporters.java index 44b8ffaef1..ceb2095a1b 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/MetricExporters.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/export/MetricExporters.java @@ -21,7 +21,7 @@ import java.util.Map; import java.util.Map.Entry; import org.springframework.boot.actuate.metrics.reader.MetricReader; -import org.springframework.boot.actuate.metrics.writer.MetricWriter; +import org.springframework.boot.actuate.metrics.writer.GaugeWriter; import org.springframework.scheduling.annotation.SchedulingConfigurer; import org.springframework.scheduling.config.IntervalTask; import org.springframework.scheduling.config.ScheduledTaskRegistrar; @@ -36,7 +36,7 @@ public class MetricExporters implements SchedulingConfigurer { private MetricReader reader; - private Map writers = new HashMap(); + private Map writers = new HashMap(); private final MetricExportProperties properties; @@ -50,7 +50,7 @@ public class MetricExporters implements SchedulingConfigurer { this.reader = reader; } - public void setWriters(Map writers) { + public void setWriters(Map writers) { this.writers.putAll(writers); } @@ -71,9 +71,9 @@ public class MetricExporters implements SchedulingConfigurer { taskRegistrar.addFixedDelayTask(task); } } - for (Entry entry : this.writers.entrySet()) { + for (Entry entry : this.writers.entrySet()) { String name = entry.getKey(); - MetricWriter writer = entry.getValue(); + GaugeWriter writer = entry.getValue(); TriggerProperties trigger = this.properties.findTrigger(name); if (trigger != null) { MetricCopyExporter exporter = getExporter(writer, trigger); @@ -86,7 +86,7 @@ public class MetricExporters implements SchedulingConfigurer { } } - private MetricCopyExporter getExporter(MetricWriter writer, + private MetricCopyExporter getExporter(GaugeWriter writer, TriggerProperties trigger) { MetricCopyExporter exporter = new MetricCopyExporter(this.reader, writer); exporter.setIncludes(trigger.getIncludes()); diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/MetricExportersTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/MetricExportersTests.java index a5faeedd2e..311f706b85 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/MetricExportersTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/metrics/export/MetricExportersTests.java @@ -24,6 +24,7 @@ import org.junit.Test; import org.mockito.Mockito; import org.springframework.boot.actuate.metrics.reader.MetricReader; +import org.springframework.boot.actuate.metrics.writer.GaugeWriter; import org.springframework.boot.actuate.metrics.writer.MetricWriter; import org.springframework.scheduling.config.ScheduledTaskRegistrar; @@ -41,7 +42,7 @@ public class MetricExportersTests { private MetricExportProperties export = new MetricExportProperties(); - private Map writers = new LinkedHashMap(); + private Map writers = new LinkedHashMap(); private MetricReader reader = Mockito.mock(MetricReader.class); diff --git a/spring-boot-samples/spring-boot-sample-metrics-opentsdb/src/main/java/sample/metrics/opentsdb/SampleOpenTsdbExportApplication.java b/spring-boot-samples/spring-boot-sample-metrics-opentsdb/src/main/java/sample/metrics/opentsdb/SampleOpenTsdbExportApplication.java index 8f983a8d23..2f3d2eeb12 100644 --- a/spring-boot-samples/spring-boot-sample-metrics-opentsdb/src/main/java/sample/metrics/opentsdb/SampleOpenTsdbExportApplication.java +++ b/spring-boot-samples/spring-boot-sample-metrics-opentsdb/src/main/java/sample/metrics/opentsdb/SampleOpenTsdbExportApplication.java @@ -21,7 +21,7 @@ import org.springframework.boot.actuate.autoconfigure.ExportMetricWriter; import org.springframework.boot.actuate.metrics.opentsdb.DefaultOpenTsdbNamingStrategy; import org.springframework.boot.actuate.metrics.opentsdb.OpenTsdbMetricWriter; import org.springframework.boot.actuate.metrics.opentsdb.OpenTsdbNamingStrategy; -import org.springframework.boot.actuate.metrics.writer.MetricWriter; +import org.springframework.boot.actuate.metrics.writer.GaugeWriter; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Bean; @@ -32,7 +32,7 @@ public class SampleOpenTsdbExportApplication { @Bean @ConfigurationProperties("metrics.export") @ExportMetricWriter - public MetricWriter openTsdbMetricWriter() { + public GaugeWriter openTsdbMetricWriter() { OpenTsdbMetricWriter writer = new OpenTsdbMetricWriter(); writer.setNamingStrategy(namingStrategy()); return writer;