Java 类org.springframework.boot.actuate.metrics.export.Exporter 实例源码

项目:spring-boot-starter-batch-web    文件:MetricsListener.java   
@Override
public void afterJob(JobExecution jobExecution) {
    long jobDuration = jobExecution.getEndTime().getTime() - jobExecution.getStartTime().getTime();
    gaugeService.submit(TIMER_PREFIX + jobExecution.getJobInstance().getJobName() + ".duration", jobDuration);
    // What the f*** is that Thread.sleep doing here? ;-)
    // Metrics are written asynchronously to Spring Boot's repository. In our tests we experienced
    // that sometimes batch execution was so fast that this listener couldn't export the metrics
    // because they hadn't been written. It all happened in the same millisecond. So we added
    // a Thread.sleep of 100 milliseconds which gives us enough safety and doesn't hurt anyone.
    try {
        Thread.sleep(100);
    } catch (InterruptedException e) {
        throw new RuntimeException(e);
    }
    // Export Metrics to Console or Remote Systems
    LOGGER.info(metricsOutputFormatter.format(exportBatchRichGauges(), exportBatchMetrics()));
    // Codahale
    if (exporters != null) {
        for (Exporter exporter : exporters) {
            if (exporter != null) {
                LOGGER.info("Exporting Metrics with " + exporter.getClass().getName());
                exporter.export();
            }
        }
    }
}
项目: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();
}
项目: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-starter-batch-web    文件:MetricsListener.java   
public MetricsListener(GaugeService gaugeService, RichGaugeReader richGaugeReader,
        MetricReader metricReader, List<Exporter> exporters) {
    this.gaugeService = gaugeService;
    this.richGaugeReader = richGaugeReader;
    this.metricReader = metricReader;
    this.exporters = exporters;
}
项目:spring-cloud-netflix-contrib    文件:AtlasAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean(Exporter.class)
public AtlasExporter exporter(AtlasMetricObserver observer, MetricPoller poller, AtlasProperties properties) {
    return new AtlasExporter(observer, poller, properties.getPublishDelay());
}
项目:spring-cloud-netflix-contrib    文件:AtlasAutoConfigurationIntegrationTests.java   
@Bean
Exporter exporter() {
    return Mockito.mock(Exporter.class);
}