Package org.springframework.boot.actuate.metrics.writer

Examples of org.springframework.boot.actuate.metrics.writer.DefaultGaugeService


  }

  @Bean
  @ConditionalOnMissingBean
  public GaugeService gaugeService() {
    return new DefaultGaugeService(this.writer);
  }
View Full Code Here


  @Test
  public void createServices() throws Exception {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(
        SyncTaskExecutorConfiguration.class,
        MetricRepositoryAutoConfiguration.class);
    DefaultGaugeService gaugeService = context.getBean(DefaultGaugeService.class);
    assertNotNull(gaugeService);
    assertNotNull(context.getBean(DefaultCounterService.class));
    gaugeService.submit("foo", 2.7);
    assertEquals(2.7, context.getBean(MetricReader.class).findOne("gauge.foo")
        .getValue());
    context.close();
  }
View Full Code Here

  @Test
  public void provideAdditionalWriter() {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(
        SyncTaskExecutorConfiguration.class, WriterConfig.class,
        MetricRepositoryAutoConfiguration.class);
    DefaultGaugeService gaugeService = context.getBean(DefaultGaugeService.class);
    assertNotNull(gaugeService);
    gaugeService.submit("foo", 2.7);
    MetricWriter writer = context.getBean("writer", MetricWriter.class);
    verify(writer).set(any(Metric.class));
    context.close();
  }
View Full Code Here

  @Test
  public void codahaleInstalledIfPresent() {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(
        SyncTaskExecutorConfiguration.class, WriterConfig.class,
        MetricRepositoryAutoConfiguration.class);
    DefaultGaugeService gaugeService = context.getBean(DefaultGaugeService.class);
    assertNotNull(gaugeService);
    gaugeService.submit("foo", 2.7);
    MetricRegistry registry = context.getBean(MetricRegistry.class);
    @SuppressWarnings("unchecked")
    Gauge<Double> gauge = (Gauge<Double>) registry.getMetrics().get("gauge.foo");
    assertEquals(new Double(2.7), gauge.getValue());
    context.close();
View Full Code Here

TOP

Related Classes of org.springframework.boot.actuate.metrics.writer.DefaultGaugeService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.