This commit is contained in:
Phillip Webb
2015-07-13 11:05:46 -07:00
parent 6fdcdd888b
commit 9ebe15232e
24 changed files with 514 additions and 309 deletions

View File

@@ -79,23 +79,17 @@ public class MetricExportAutoConfiguration {
reader = new CompositeMetricReader(
this.readers.toArray(new MetricReader[this.readers.size()]));
}
MetricExporters exporters = null;
if (reader == null && this.exporters.isEmpty()) {
return new NoOpSchedulingConfigurer();
}
MetricExporters exporters = new MetricExporters(this.properties);
if (reader != null) {
exporters = new MetricExporters(this.properties);
writers.putAll(this.writers);
exporters.setReader(reader);
exporters.setWriters(writers);
}
if (!this.exporters.isEmpty()) {
if (exporters==null) {
exporters = new MetricExporters(this.properties);
}
exporters.setExporters(this.exporters);
}
if (exporters!=null) {
return exporters;
}
return new NoOpSchedulingConfigurer();
exporters.setExporters(this.exporters);
return exporters;
}
@Configuration

View File

@@ -16,9 +16,6 @@
package org.springframework.boot.actuate.metrics.export;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -29,6 +26,9 @@ import org.springframework.boot.actuate.metrics.reader.MetricReader;
import org.springframework.boot.actuate.metrics.writer.MetricWriter;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
/**
* Tests for {@link MetricExporters}.
*