Пример #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"));
  }
Пример #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"));
  }
Пример #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"));
  }