@Test public void requestedTimeIsDelegatedToIntervals() { when(rolling1.intervals(30L)).thenReturn(intervals1); when(rolling2.intervals(30L)).thenReturn(intervals2); healthGauge.getHealth(10L, TimeUnit.NANOSECONDS, 30L); verify(intervals1).limit(10L, TimeUnit.NANOSECONDS); verify(intervals2).limit(10L, TimeUnit.NANOSECONDS); }
public synchronized HealthSnapshot getHealth(long timePeriod, TimeUnit timeUnit, long nanoTime) { long total = 0; long failures = 0; for (InternalGauge<?> gauge : gauges) { gauge.refreshHealth(timePeriod, timeUnit, nanoTime); total += gauge.total; failures += gauge.failures; } return new HealthSnapshot(total, failures); }
HealthGauge { public synchronized HealthSnapshot getHealth(long timePeriod, TimeUnit timeUnit, long nanoTime) { long total = 0; long failures = 0; for (InternalGauge<?> gauge : gauges) { gauge.refreshHealth(timePeriod, timeUnit, nanoTime); total += gauge.total; failures += gauge.failures; } return new HealthSnapshot(total, failures); } }
HealthGauge { public synchronized HealthSnapshot getHealth(long timePeriod, TimeUnit timeUnit, long nanoTime) { long total = 0; long failures = 0; for (InternalGauge<?> gauge : gauges) { gauge.refreshHealth(timePeriod, timeUnit, nanoTime); total += gauge.total; failures += gauge.failures; } return new HealthSnapshot(total, failures); }  }
HealthGauge { public synchronized HealthSnapshot getHealth(long timePeriod, TimeUnit timeUnit, long nanoTime) { long total = 0; long failures = 0; for (InternalGauge<?> gauge : gauges) { gauge.refreshHealth(timePeriod, timeUnit, nanoTime); total += gauge.total; failures += gauge.failures; } return new HealthSnapshot(total, failures); }  synchronized HealthSnapshot getHealth(long timePeriod, TimeUnit timeUnit, long nanoTime); void add(Rolling<PartitionedCount<Result>> metrics); }
HealthGauge { public synchronized HealthSnapshot getHealth(long timePeriod, TimeUnit timeUnit, long nanoTime) { long total = 0; long failures = 0; for (InternalGauge<?> gauge : gauges) { gauge.refreshHealth(timePeriod, timeUnit, nanoTime); total += gauge.total; failures += gauge.failures; } return new HealthSnapshot(total, failures); }  synchronized HealthSnapshot getHealth(long timePeriod, TimeUnit timeUnit, long nanoTime); void add(Rolling<PartitionedCount<Result>> metrics);  }