Esempio n. 1
0
  @Test
  public void reportsMeterValues() throws Exception {
    final Meter meter = mock(Meter.class);
    when(meter.getCount()).thenReturn(1L);
    when(meter.getMeanRate()).thenReturn(2.0);
    when(meter.getOneMinuteRate()).thenReturn(3.0);
    when(meter.getFiveMinuteRate()).thenReturn(4.0);
    when(meter.getFifteenMinuteRate()).thenReturn(5.0);

    reporter.report(
        this.<Gauge>map(),
        this.<Counter>map(),
        this.<Histogram>map(),
        map("test.meter", meter),
        this.<Timer>map());

    verify(ganglia)
        .announce(
            "test.meter.count",
            "1",
            GMetricType.DOUBLE,
            "events",
            GMetricSlope.BOTH,
            60,
            0,
            "test");
    verify(ganglia)
        .announce(
            "test.meter.mean_rate",
            "2.0",
            GMetricType.DOUBLE,
            "events/second",
            GMetricSlope.BOTH,
            60,
            0,
            "test");
    verify(ganglia)
        .announce(
            "test.meter.m1_rate",
            "3.0",
            GMetricType.DOUBLE,
            "events/second",
            GMetricSlope.BOTH,
            60,
            0,
            "test");
    verify(ganglia)
        .announce(
            "test.meter.m5_rate",
            "4.0",
            GMetricType.DOUBLE,
            "events/second",
            GMetricSlope.BOTH,
            60,
            0,
            "test");
    verify(ganglia)
        .announce(
            "test.meter.m15_rate",
            "5.0",
            GMetricType.DOUBLE,
            "events/second",
            GMetricSlope.BOTH,
            60,
            0,
            "test");
    verifyNoMoreInteractions(ganglia);
  }