Exemplo n.º 1
0
  @Test
  public void aGaugeAnnotatedMethodWithAbsoluteName() throws Exception {
    instance.doAThingWithAbsoluteName();

    final Gauge metric = registry.getGauges().get(name("absoluteName"));

    assertThat("Guice creates a metric", metric, is(notNullValue()));

    assertThat(
        "Guice creates a gauge with the given value",
        ((Gauge<String>) metric).getValue(),
        is("anotherThingWithAbsoluteName"));
  }
Exemplo n.º 2
0
  @Test
  public void aGaugeAnnotatedMethod() throws Exception {
    instance.doAThing();

    final Gauge metric = registry.getGauges().get(name(InstrumentedWithGauge.class, "things"));

    assertThat("Guice creates a metric", metric, is(notNullValue()));

    assertThat(
        "Guice creates a gauge with the given value",
        ((Gauge<String>) metric).getValue(),
        is("poop"));
  }
Exemplo n.º 3
0
  @Test
  public void aGaugeAnnotatedMethodWithDefaultName() throws Exception {
    instance.doAnotherThing();

    final Gauge metric =
        registry.getGauges().get(name(InstrumentedWithGauge.class, "doAnotherThing", GAUGE_SUFFIX));

    assertThat("Guice creates a metric", metric, is(notNullValue()));

    assertThat(
        "Guice creates a gauge with the given value",
        ((Gauge<String>) metric).getValue(),
        is("anotherThing"));
  }