|
|
@ -16,9 +16,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
package org.springframework.boot.actuate.autoconfigure;
|
|
|
|
package org.springframework.boot.actuate.autoconfigure;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
|
import org.springframework.boot.actuate.metrics.CounterService;
|
|
|
|
import org.springframework.boot.actuate.metrics.CounterService;
|
|
|
|
import org.springframework.boot.actuate.metrics.GaugeService;
|
|
|
|
import org.springframework.boot.actuate.metrics.GaugeService;
|
|
|
|
import org.springframework.boot.actuate.metrics.buffer.BufferCounterService;
|
|
|
|
import org.springframework.boot.actuate.metrics.buffer.BufferCounterService;
|
|
|
@ -170,11 +172,20 @@ public class MetricRepositoryAutoConfiguration {
|
|
|
|
@Autowired(required = false)
|
|
|
|
@Autowired(required = false)
|
|
|
|
private List<MetricWriter> writers;
|
|
|
|
private List<MetricWriter> writers;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired(required = false)
|
|
|
|
|
|
|
|
@Qualifier("actuatorMetricRepository")
|
|
|
|
|
|
|
|
private MetricWriter actuatorMetricRepository;
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
@Bean
|
|
|
|
@ConditionalOnMissingBean
|
|
|
|
@ConditionalOnMissingBean
|
|
|
|
@ConditionalOnBean(MetricWriter.class)
|
|
|
|
@ConditionalOnBean(MetricWriter.class)
|
|
|
|
public MetricCopyExporter messageChannelMetricExporter(MetricReader reader) {
|
|
|
|
public MetricCopyExporter messageChannelMetricExporter(MetricReader reader) {
|
|
|
|
return new MetricCopyExporter(reader, new CompositeMetricWriter(this.writers)) {
|
|
|
|
List<MetricWriter> writers = new ArrayList<MetricWriter>(this.writers);
|
|
|
|
|
|
|
|
if (this.actuatorMetricRepository != null
|
|
|
|
|
|
|
|
&& writers.contains(this.actuatorMetricRepository)) {
|
|
|
|
|
|
|
|
writers.remove(this.actuatorMetricRepository);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return new MetricCopyExporter(reader, new CompositeMetricWriter(writers)) {
|
|
|
|
@Scheduled(fixedDelayString = "${spring.metrics.export.delayMillis:5000}")
|
|
|
|
@Scheduled(fixedDelayString = "${spring.metrics.export.delayMillis:5000}")
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void export() {
|
|
|
|
public void export() {
|
|
|
|