Java 类org.springframework.boot.actuate.metrics.rich.RichGaugeReader 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:PublicMetricsAutoConfigurationTests.java   
@Test
public void richGaugePublicMetrics() {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(
            RichGaugeReaderConfig.class, MetricRepositoryAutoConfiguration.class,
            PublicMetricsAutoConfiguration.class);
    RichGaugeReader richGaugeReader = context.getBean(RichGaugeReader.class);
    assertThat(richGaugeReader).isNotNull();
    given(richGaugeReader.findAll())
            .willReturn(Collections.singletonList(new RichGauge("bar", 3.7d)));
    RichGaugeReaderPublicMetrics publicMetrics = context
            .getBean(RichGaugeReaderPublicMetrics.class);
    assertThat(publicMetrics).isNotNull();
    Collection<Metric<?>> metrics = publicMetrics.metrics();
    assertThat(metrics).isNotNull();
    assertThat(6).isEqualTo(metrics.size());
    assertHasMetric(metrics, new Metric<Double>("bar.val", 3.7d));
    assertHasMetric(metrics, new Metric<Double>("bar.avg", 3.7d));
    assertHasMetric(metrics, new Metric<Double>("bar.min", 3.7d));
    assertHasMetric(metrics, new Metric<Double>("bar.max", 3.7d));
    assertHasMetric(metrics, new Metric<Double>("bar.alpha", -1.d));
    assertHasMetric(metrics, new Metric<Long>("bar.count", 1L));
    context.close();
}
项目:spring-boot-concourse    文件:PublicMetricsAutoConfigurationTests.java   
@Test
public void richGaugePublicMetrics() {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(
            RichGaugeReaderConfig.class, MetricRepositoryAutoConfiguration.class,
            PublicMetricsAutoConfiguration.class);
    RichGaugeReader richGaugeReader = context.getBean(RichGaugeReader.class);
    assertThat(richGaugeReader).isNotNull();
    given(richGaugeReader.findAll())
            .willReturn(Collections.singletonList(new RichGauge("bar", 3.7d)));
    RichGaugeReaderPublicMetrics publicMetrics = context
            .getBean(RichGaugeReaderPublicMetrics.class);
    assertThat(publicMetrics).isNotNull();
    Collection<Metric<?>> metrics = publicMetrics.metrics();
    assertThat(metrics).isNotNull();
    assertThat(6).isEqualTo(metrics.size());
    assertHasMetric(metrics, new Metric<Double>("bar.val", 3.7d));
    assertHasMetric(metrics, new Metric<Double>("bar.avg", 3.7d));
    assertHasMetric(metrics, new Metric<Double>("bar.min", 3.7d));
    assertHasMetric(metrics, new Metric<Double>("bar.max", 3.7d));
    assertHasMetric(metrics, new Metric<Double>("bar.alpha", -1.d));
    assertHasMetric(metrics, new Metric<Long>("bar.count", 1L));
    context.close();
}
项目:contestparser    文件:PublicMetricsAutoConfigurationTests.java   
@Test
public void richGaugePublicMetrics() {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(
            RichGaugeReaderConfig.class, MetricRepositoryAutoConfiguration.class,
            PublicMetricsAutoConfiguration.class);
    RichGaugeReader richGaugeReader = context.getBean(RichGaugeReader.class);
    assertNotNull(richGaugeReader);
    given(richGaugeReader.findAll())
            .willReturn(Collections.singletonList(new RichGauge("bar", 3.7d)));
    RichGaugeReaderPublicMetrics publicMetrics = context
            .getBean(RichGaugeReaderPublicMetrics.class);
    assertNotNull(publicMetrics);
    Collection<Metric<?>> metrics = publicMetrics.metrics();
    assertNotNull(metrics);
    assertEquals(metrics.size(), 6);
    assertHasMetric(metrics, new Metric<Double>("bar.val", 3.7d));
    assertHasMetric(metrics, new Metric<Double>("bar.avg", 3.7d));
    assertHasMetric(metrics, new Metric<Double>("bar.min", 3.7d));
    assertHasMetric(metrics, new Metric<Double>("bar.max", 3.7d));
    assertHasMetric(metrics, new Metric<Double>("bar.alpha", -1.d));
    assertHasMetric(metrics, new Metric<Long>("bar.count", 1L));
    context.close();
}
项目: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;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RichGaugeExporter.java   
public RichGaugeExporter(RichGaugeReader reader, PrefixMetricWriter writer) {
    this(reader, writer, "");
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RichGaugeExporter.java   
public RichGaugeExporter(RichGaugeReader reader, PrefixMetricWriter writer,
        String prefix) {
    super(prefix);
    this.reader = reader;
    this.writer = writer;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:PublicMetricsAutoConfiguration.java   
@Bean
@ConditionalOnBean(RichGaugeReader.class)
public RichGaugeReaderPublicMetrics richGaugePublicMetrics(
        RichGaugeReader richGaugeReader) {
    return new RichGaugeReaderPublicMetrics(richGaugeReader);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:RichGaugeReaderPublicMetrics.java   
public RichGaugeReaderPublicMetrics(RichGaugeReader richGaugeReader) {
    Assert.notNull(richGaugeReader, "RichGaugeReader must not be null");
    this.richGaugeReader = richGaugeReader;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:PublicMetricsAutoConfigurationTests.java   
@Bean
public RichGaugeReader richGaugeReader() {
    return mock(RichGaugeReader.class);
}
项目:spring-boot-concourse    文件:RichGaugeExporter.java   
public RichGaugeExporter(RichGaugeReader reader, PrefixMetricWriter writer) {
    this(reader, writer, "");
}
项目:spring-boot-concourse    文件:RichGaugeExporter.java   
public RichGaugeExporter(RichGaugeReader reader, PrefixMetricWriter writer,
        String prefix) {
    super(prefix);
    this.reader = reader;
    this.writer = writer;
}
项目:spring-boot-concourse    文件:PublicMetricsAutoConfiguration.java   
@Bean
@ConditionalOnBean(RichGaugeReader.class)
public RichGaugeReaderPublicMetrics richGaugePublicMetrics(
        RichGaugeReader richGaugeReader) {
    return new RichGaugeReaderPublicMetrics(richGaugeReader);
}
项目:spring-boot-concourse    文件:RichGaugeReaderPublicMetrics.java   
public RichGaugeReaderPublicMetrics(RichGaugeReader richGaugeReader) {
    Assert.notNull(richGaugeReader, "RichGaugeReader must not be null");
    this.richGaugeReader = richGaugeReader;
}
项目:spring-boot-concourse    文件:PublicMetricsAutoConfigurationTests.java   
@Bean
public RichGaugeReader richGaugeReader() {
    return mock(RichGaugeReader.class);
}
项目:contestparser    文件:RichGaugeExporter.java   
public RichGaugeExporter(RichGaugeReader reader, PrefixMetricWriter writer) {
    this(reader, writer, "");
}
项目:contestparser    文件:RichGaugeExporter.java   
public RichGaugeExporter(RichGaugeReader reader, PrefixMetricWriter writer,
        String prefix) {
    super(prefix);
    this.reader = reader;
    this.writer = writer;
}
项目:contestparser    文件:PublicMetricsAutoConfiguration.java   
@Bean
@ConditionalOnBean(RichGaugeReader.class)
public RichGaugeReaderPublicMetrics richGaugePublicMetrics(
        RichGaugeReader richGaugeReader) {
    return new RichGaugeReaderPublicMetrics(richGaugeReader);
}
项目:contestparser    文件:RichGaugeReaderPublicMetrics.java   
public RichGaugeReaderPublicMetrics(RichGaugeReader richGaugeReader) {
    Assert.notNull(richGaugeReader, "RichGaugeReader must not be null");
    this.richGaugeReader = richGaugeReader;
}
项目:contestparser    文件:PublicMetricsAutoConfigurationTests.java   
@Bean
public RichGaugeReader richGaugeReader() {
    return mock(RichGaugeReader.class);
}