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

项目: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());
    }
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MetricExportAutoConfigurationTests.java   
@Test
public void provideAdditionalWriter() {
    this.context = new AnnotationConfigApplicationContext(WriterConfig.class,
            MetricRepositoryAutoConfiguration.class,
            MetricExportAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    GaugeService gaugeService = this.context.getBean(GaugeService.class);
    assertThat(gaugeService).isNotNull();
    gaugeService.submit("foo", 2.7);
    MetricExporters exporters = this.context.getBean(MetricExporters.class);
    MetricCopyExporter exporter = (MetricCopyExporter) exporters.getExporters()
            .get("writer");
    exporter.setIgnoreTimestamps(true);
    exporter.export();
    MetricWriter writer = this.context.getBean("writer", MetricWriter.class);
    Mockito.verify(writer, Mockito.atLeastOnce()).set(Matchers.any(Metric.class));
}
项目: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());
    }
}
项目:spring-boot-concourse    文件:MetricExportAutoConfigurationTests.java   
@Test
public void provideAdditionalWriter() {
    this.context = new AnnotationConfigApplicationContext(WriterConfig.class,
            MetricRepositoryAutoConfiguration.class,
            MetricExportAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    GaugeService gaugeService = this.context.getBean(GaugeService.class);
    assertThat(gaugeService).isNotNull();
    gaugeService.submit("foo", 2.7);
    MetricExporters exporters = this.context.getBean(MetricExporters.class);
    MetricCopyExporter exporter = (MetricCopyExporter) exporters.getExporters()
            .get("writer");
    exporter.setIgnoreTimestamps(true);
    exporter.export();
    MetricWriter writer = this.context.getBean("writer", MetricWriter.class);
    Mockito.verify(writer, Mockito.atLeastOnce()).set(Matchers.any(Metric.class));
}
项目:contestparser    文件:MetricCopyExporter.java   
private void flush(MetricWriter 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());
    }
}
项目:contestparser    文件:MetricExportAutoConfigurationTests.java   
@Test
public void provideAdditionalWriter() {
    this.context = new AnnotationConfigApplicationContext(WriterConfig.class,
            MetricRepositoryAutoConfiguration.class,
            MetricExportAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    GaugeService gaugeService = this.context.getBean(GaugeService.class);
    assertNotNull(gaugeService);
    gaugeService.submit("foo", 2.7);
    MetricExporters exporters = this.context.getBean(MetricExporters.class);
    MetricCopyExporter exporter = (MetricCopyExporter) exporters.getExporters()
            .get("writer");
    exporter.setIgnoreTimestamps(true);
    exporter.export();
    MetricWriter writer = this.context.getBean("writer", MetricWriter.class);
    Mockito.verify(writer, Mockito.atLeastOnce()).set(Matchers.any(Metric.class));
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MetricExportAutoConfigurationTests.java   
@Test
public void metricsFlushAutomatically() throws Exception {
    this.context = new AnnotationConfigApplicationContext(WriterConfig.class,
            MetricRepositoryAutoConfiguration.class,
            MetricExportAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    GaugeService gaugeService = this.context.getBean(GaugeService.class);
    assertThat(gaugeService).isNotNull();
    gaugeService.submit("foo", 2.7);
    MetricExporters flusher = this.context.getBean(MetricExporters.class);
    flusher.close(); // this will be called by Spring on shutdown
    MetricWriter writer = this.context.getBean("writer", MetricWriter.class);
    Mockito.verify(writer, Mockito.atLeastOnce()).set(Matchers.any(Metric.class));
}
项目:spring-boot-concourse    文件:MetricExportAutoConfigurationTests.java   
@Test
public void metricsFlushAutomatically() throws Exception {
    this.context = new AnnotationConfigApplicationContext(WriterConfig.class,
            MetricRepositoryAutoConfiguration.class,
            MetricExportAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    GaugeService gaugeService = this.context.getBean(GaugeService.class);
    assertThat(gaugeService).isNotNull();
    gaugeService.submit("foo", 2.7);
    MetricExporters flusher = this.context.getBean(MetricExporters.class);
    flusher.close(); // this will be called by Spring on shutdown
    MetricWriter writer = this.context.getBean("writer", MetricWriter.class);
    Mockito.verify(writer, Mockito.atLeastOnce()).set(Matchers.any(Metric.class));
}
项目:contestparser    文件:MetricExporters.java   
private MetricCopyExporter getExporter(MetricWriter writer,
        TriggerProperties trigger) {
    MetricCopyExporter exporter = new MetricCopyExporter(this.reader, writer);
    exporter.setIncludes(trigger.getIncludes());
    exporter.setExcludes(trigger.getExcludes());
    exporter.setSendLatest(trigger.isSendLatest());
    return exporter;
}
项目:contestparser    文件:SampleOpenTsdbExportApplication.java   
@Bean
@ConfigurationProperties("metrics.export")
@ExportMetricWriter
public MetricWriter openTsdbMetricWriter() {
    OpenTsdbMetricWriter writer = new OpenTsdbMetricWriter();
    writer.setNamingStrategy(namingStrategy());
    return writer;
}
项目:kork    文件:SpectatorConfiguration.java   
@Bean
@Primary
@ConditionalOnMissingClass("org.springframework.messaging.MessageChannel")
@ConditionalOnMissingBean(name = "primaryMetricWriter")
public MetricWriter primaryMetricWriter(List<MetricWriter> writers) {
  return new CompositeMetricWriter(writers);
}
项目:spring-boot-starter-batch-web    文件:MetricsTestApplication.java   
@Bean(name = "primaryMetricWriter")
@Primary
static public MetricWriter primaryMetricWriter(List<MetricWriter> writers) {
    // Normally the Metrics are written asynchronously to Spring Boot's repository. In tests we need to do it synchronously to be able to verify
    // the correct output.
    MetricWriter compositeMetricWriter = new CompositeMetricWriter(writers);
    return compositeMetricWriter;
}
项目:cloudbreak    文件:AppConfig.java   
@Bean
@ExportMetricWriter
/*
 * Prometheus is not capable to scrape json metrics so we need to expose the actuator metrics to jmx. Every
 * counter and gauge metrics are exposed too.
 */
public MetricWriter metricWriter(MBeanExporter exporter) {
    return new JmxMetricWriter(exporter);
}
项目:jhipster-microservices-example    文件:MetricsConfiguration.java   
@Bean
@ConditionalOnProperty("jhipster.logging.spectator-metrics.enabled")
@ExportMetricWriter
MetricWriter metricWriter() {
    return new SpectatorLogMetricWriter();
}
项目:jhipster-microservices-example    文件:MetricsConfiguration.java   
@Bean
@ConditionalOnProperty("jhipster.logging.spectator-metrics.enabled")
@ExportMetricWriter
MetricWriter metricWriter() {
    return new SpectatorLogMetricWriter();
}
项目:jhipster-microservices-example    文件:MetricsConfiguration.java   
@Bean
@ConditionalOnProperty("jhipster.logging.spectator-metrics.enabled")
@ExportMetricWriter
MetricWriter metricWriter() {
    return new SpectatorLogMetricWriter();
}
项目:xm-ms-balance    文件:MetricsConfiguration.java   
@Bean
@ConditionalOnProperty("jhipster.logging.spectator-metrics.enabled")
@ExportMetricWriter
MetricWriter metricWriter() {
    return new SpectatorLogMetricWriter();
}
项目:Armory    文件:MetricsConfiguration.java   
@Bean
@ConditionalOnProperty("jhipster.logging.spectator-metrics.enabled")
@ExportMetricWriter
MetricWriter metricWriter() {
    return new SpectatorLogMetricWriter();
}
项目:Armory    文件:MetricsConfiguration.java   
@Bean
@ConditionalOnProperty("jhipster.logging.spectator-metrics.enabled")
@ExportMetricWriter
MetricWriter metricWriter() {
    return new SpectatorLogMetricWriter();
}
项目:xm-ms-dashboard    文件:MetricsConfiguration.java   
@Bean
@ConditionalOnProperty("jhipster.logging.spectator-metrics.enabled")
@ExportMetricWriter
MetricWriter metricWriter() {
    return new SpectatorLogMetricWriter();
}
项目:xm-gate    文件:MetricsConfiguration.java   
@Bean
@ConditionalOnProperty("jhipster.logging.spectator-metrics.enabled")
@ExportMetricWriter
MetricWriter metricWriter() {
    return new SpectatorLogMetricWriter();
}
项目:xm-ms-entity    文件:MetricsConfiguration.java   
@Bean
@ConditionalOnProperty("jhipster.logging.spectator-metrics.enabled")
@ExportMetricWriter
MetricWriter metricWriter() {
    return new SpectatorLogMetricWriter();
}
项目:spring-io    文件:MetricsConfiguration.java   
@Bean
@ConditionalOnProperty("jhipster.logging.spectator-metrics.enabled")
@ExportMetricWriter
MetricWriter metricWriter() {
    return new SpectatorLogMetricWriter();
}
项目:spring-io    文件:MetricsConfiguration.java   
@Bean
@ConditionalOnProperty("jhipster.logging.spectator-metrics.enabled")
@ExportMetricWriter
MetricWriter metricWriter() {
    return new SpectatorLogMetricWriter();
}
项目:spring-io    文件:MetricsConfiguration.java   
@Bean
@ConditionalOnProperty("jhipster.logging.spectator-metrics.enabled")
@ExportMetricWriter
MetricWriter metricWriter() {
    return new SpectatorLogMetricWriter();
}
项目:xm-ms-timeline    文件:MetricsConfiguration.java   
@Bean
@ConditionalOnProperty("jhipster.logging.spectator-metrics.enabled")
@ExportMetricWriter
MetricWriter metricWriter() {
    return new SpectatorLogMetricWriter();
}
项目:devoxxus-jhipster-microservices-demo    文件:MetricsConfiguration.java   
@Bean
@ConditionalOnProperty("jhipster.logging.spectator-metrics.enabled")
@ExportMetricWriter
MetricWriter metricWriter() {
    return new SpectatorLogMetricWriter();
}
项目:devoxxus-jhipster-microservices-demo    文件:MetricsConfiguration.java   
@Bean
@ConditionalOnProperty("jhipster.logging.spectator-metrics.enabled")
@ExportMetricWriter
MetricWriter metricWriter() {
    return new SpectatorLogMetricWriter();
}
项目:devoxxus-jhipster-microservices-demo    文件:MetricsConfiguration.java   
@Bean
@ConditionalOnProperty("jhipster.logging.spectator-metrics.enabled")
@ExportMetricWriter
MetricWriter metricWriter() {
    return new SpectatorLogMetricWriter();
}
项目:xm-ms-config    文件:MetricsConfiguration.java   
@Bean
@ConditionalOnProperty("jhipster.logging.spectator-metrics.enabled")
@ExportMetricWriter
MetricWriter metricWriter() {
    return new SpectatorLogMetricWriter();
}
项目:Microservices-with-JHipster-and-Spring-Boot    文件:MetricsConfiguration.java   
@Bean
@ConditionalOnProperty("jhipster.logging.spectator-metrics.enabled")
@ExportMetricWriter
MetricWriter metricWriter() {
    return new SpectatorLogMetricWriter();
}
项目:Microservices-with-JHipster-and-Spring-Boot    文件:MetricsConfiguration.java   
@Bean
@ConditionalOnProperty("jhipster.logging.spectator-metrics.enabled")
@ExportMetricWriter
MetricWriter metricWriter() {
    return new SpectatorLogMetricWriter();
}
项目:Microservices-with-JHipster-and-Spring-Boot    文件:MetricsConfiguration.java   
@Bean
@ConditionalOnProperty("jhipster.logging.spectator-metrics.enabled")
@ExportMetricWriter
MetricWriter metricWriter() {
    return new SpectatorLogMetricWriter();
}
项目:secrets-proxy    文件:MgmtConfig.java   
/**
 * Exports actuator metrics to JMX.
 */
@Bean
@ExportMetricWriter
public MetricWriter metricWriter(MBeanExporter exporter) {
    return new JmxMetricWriter(exporter);
}
项目:statful-client-springboot    文件:SpringbootClientConfiguration.java   
/**
 * Export a new {@link StatfulMetricWriter} metrics writer.
 * @return {@link MetricWriter}
 */
@Bean
@ExportMetricWriter
MetricWriter metricWriter() {
    return new StatfulMetricWriter();
}
项目:cat-boot    文件:ClusterMetricsConfig.java   
@Bean
@ExportMetricWriter
public MetricWriter metricWriter(MetricExportProperties export) {
    return new RedisMetricRepository(redisConnectionFactory,
            export.getRedis().getPrefix(), export.getRedis().getKey());
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MetricRepositoryAutoConfiguration.java   
LegacyMetricServicesConfiguration(@ActuatorMetricWriter MetricWriter writer) {
    this.writer = writer;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MetricExportAutoConfigurationTests.java   
@Bean
@ExportMetricWriter
public MetricWriter writer() {
    return Mockito.mock(MetricWriter.class);
}
项目:Thesis-JHipster    文件:_MetricsConfiguration.java   
@Bean
@ConditionalOnProperty("jhipster.logging.spectator-metrics.enabled")
@ExportMetricWriter
MetricWriter metricWriter() {
    return new SpectatorLogMetricWriter();
}
项目:Thesis-JHipster    文件:MetricsConfiguration.java   
@Bean
@ConditionalOnProperty("jhipster.logging.spectator-metrics.enabled")
@ExportMetricWriter
MetricWriter metricWriter() {
    return new SpectatorLogMetricWriter();
}