use of org.springframework.boot.actuate.metrics.reader.CompositeMetricReader in project spring-boot by spring-projects.
the class MetricExportAutoConfiguration method metricWritersMetricExporter.
@Bean
@ConditionalOnMissingBean(name = "metricWritersMetricExporter")
public SchedulingConfigurer metricWritersMetricExporter(MetricExportProperties properties) {
Map<String, GaugeWriter> writers = new HashMap<>();
MetricReader reader = this.endpointReader;
if (reader == null && !CollectionUtils.isEmpty(this.readers)) {
reader = new CompositeMetricReader(this.readers.toArray(new MetricReader[this.readers.size()]));
}
if (reader == null && CollectionUtils.isEmpty(this.exporters)) {
return new NoOpSchedulingConfigurer();
}
MetricExporters exporters = new MetricExporters(properties);
if (reader != null) {
if (!CollectionUtils.isEmpty(this.writers)) {
writers.putAll(this.writers);
}
exporters.setReader(reader);
exporters.setWriters(writers);
}
exporters.setExporters(this.exporters == null ? Collections.<String, Exporter>emptyMap() : this.exporters);
return exporters;
}
Aggregations