Java 类org.springframework.boot.actuate.metrics.writer.GaugeWriter 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MetricCopyExporter.java   
private void flush(GaugeWriter writer) {
    if (writer instanceof CompositeMetricWriter) {
        for (MetricWriter child : (CompositeMetricWriter) writer) {
            flush(child);
        }
    }
    try {
        if (ClassUtils.isPresent("java.io.Flushable", null)) {
            if (writer instanceof Flushable) {
                ((Flushable) writer).flush();
                return;
            }
        }
        Method method = ReflectionUtils.findMethod(writer.getClass(), "flush");
        if (method != null) {
            ReflectionUtils.invokeMethod(method, writer);
        }
    }
    catch (Exception ex) {
        logger.warn("Could not flush MetricWriter: " + ex.getClass() + ": "
                + ex.getMessage());
    }
}
项目:spring-boot-concourse    文件:MetricCopyExporter.java   
private void flush(GaugeWriter writer) {
    if (writer instanceof CompositeMetricWriter) {
        for (MetricWriter child : (CompositeMetricWriter) writer) {
            flush(child);
        }
    }
    try {
        if (ClassUtils.isPresent("java.io.Flushable", null)) {
            if (writer instanceof Flushable) {
                ((Flushable) writer).flush();
                return;
            }
        }
        Method method = ReflectionUtils.findMethod(writer.getClass(), "flush");
        if (method != null) {
            ReflectionUtils.invokeMethod(method, writer);
        }
    }
    catch (Exception ex) {
        logger.warn("Could not flush MetricWriter: " + ex.getClass() + ": "
                + ex.getMessage());
    }
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MetricCopyExporter.java   
/**
 * Create a new {@link MetricCopyExporter} instance.
 * @param reader the metric reader
 * @param writer the metric writer
 * @param prefix the name prefix
 */
public MetricCopyExporter(MetricReader reader, GaugeWriter writer, String prefix) {
    super(prefix);
    this.reader = reader;
    this.writer = writer;
    if (writer instanceof CounterWriter) {
        this.counter = (CounterWriter) writer;
    }
    else {
        this.counter = null;
    }
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MetricExporters.java   
private MetricCopyExporter getExporter(GaugeWriter writer,
        TriggerProperties trigger) {
    MetricCopyExporter exporter = new MetricCopyExporter(this.reader, writer);
    exporter.setIncludes(trigger.getIncludes());
    exporter.setExcludes(trigger.getExcludes());
    exporter.setSendLatest(trigger.isSendLatest());
    return exporter;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MetricExportAutoConfiguration.java   
public MetricExportAutoConfiguration(MetricExportProperties properties,
        ObjectProvider<MetricsEndpointMetricReader> endpointReaderProvider,
        @ExportMetricReader ObjectProvider<List<MetricReader>> readersProvider,
        @ExportMetricWriter ObjectProvider<Map<String, GaugeWriter>> writersProvider,
        ObjectProvider<Map<String, Exporter>> exportersProvider) {
    this.properties = properties;
    this.endpointReader = endpointReaderProvider.getIfAvailable();
    this.readers = readersProvider.getIfAvailable();
    this.writers = writersProvider.getIfAvailable();
    this.exporters = exportersProvider.getIfAvailable();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:SampleOpenTsdbExportApplication.java   
@Bean
@ConfigurationProperties("metrics.export")
@ExportMetricWriter
public GaugeWriter openTsdbMetricWriter() {
    OpenTsdbGaugeWriter writer = new OpenTsdbGaugeWriter();
    writer.setNamingStrategy(namingStrategy());
    return writer;
}
项目:spring-boot-concourse    文件:MetricCopyExporter.java   
/**
 * Create a new {@link MetricCopyExporter} instance.
 * @param reader the metric reader
 * @param writer the metric writer
 * @param prefix the name prefix
 */
public MetricCopyExporter(MetricReader reader, GaugeWriter writer, String prefix) {
    super(prefix);
    this.reader = reader;
    this.writer = writer;
    if (writer instanceof CounterWriter) {
        this.counter = (CounterWriter) writer;
    }
    else {
        this.counter = null;
    }
}
项目:spring-boot-concourse    文件:MetricExporters.java   
private MetricCopyExporter getExporter(GaugeWriter writer,
        TriggerProperties trigger) {
    MetricCopyExporter exporter = new MetricCopyExporter(this.reader, writer);
    exporter.setIncludes(trigger.getIncludes());
    exporter.setExcludes(trigger.getExcludes());
    exporter.setSendLatest(trigger.isSendLatest());
    return exporter;
}
项目:spring-boot-concourse    文件:MetricExportAutoConfiguration.java   
public MetricExportAutoConfiguration(MetricExportProperties properties,
        ObjectProvider<MetricsEndpointMetricReader> endpointReaderProvider,
        @ExportMetricReader ObjectProvider<List<MetricReader>> readersProvider,
        @ExportMetricWriter ObjectProvider<Map<String, GaugeWriter>> writersProvider,
        ObjectProvider<Map<String, Exporter>> exportersProvider) {
    this.properties = properties;
    this.endpointReader = endpointReaderProvider.getIfAvailable();
    this.readers = readersProvider.getIfAvailable();
    this.writers = writersProvider.getIfAvailable();
    this.exporters = exportersProvider.getIfAvailable();
}
项目:spring-boot-concourse    文件:SampleOpenTsdbExportApplication.java   
@Bean
@ConfigurationProperties("metrics.export")
@ExportMetricWriter
public GaugeWriter openTsdbMetricWriter() {
    OpenTsdbGaugeWriter writer = new OpenTsdbGaugeWriter();
    writer.setNamingStrategy(namingStrategy());
    return writer;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MetricExporters.java   
public void setWriters(Map<String, GaugeWriter> writers) {
    this.writers.putAll(writers);
}
项目:spring-boot-concourse    文件:MetricExporters.java   
public void setWriters(Map<String, GaugeWriter> writers) {
    this.writers.putAll(writers);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MetricCopyExporter.java   
/**
 * Create a new {@link MetricCopyExporter} instance.
 * @param reader the metric reader
 * @param writer the metric writer
 */
public MetricCopyExporter(MetricReader reader, GaugeWriter writer) {
    this(reader, writer, "");
}
项目:spring-boot-concourse    文件:MetricCopyExporter.java   
/**
 * Create a new {@link MetricCopyExporter} instance.
 * @param reader the metric reader
 * @param writer the metric writer
 */
public MetricCopyExporter(MetricReader reader, GaugeWriter writer) {
    this(reader, writer, "");
}