@Override public Snapshot getSnapshot() { return delegate.getSnapshot(); }
@Test public void testSnapshotValues() throws Exception { Assert.assertArrayEquals( "The globalTimer does not contain the expected values: " + Arrays.toString(SAMPLE_LONG_DATA), SAMPLE_LONG_DATA, globalTimer.getSnapshot().getValues()); }
@Test public void testSnapshotMedian() throws Exception { TestUtils.assertEqualsWithTolerance(480, globalTimer.getSnapshot().getMedian()); }
@Test public void testSnapshot999thPercentile() throws Exception { TestUtils.assertEqualsWithTolerance(990, globalTimer.getSnapshot().get999thPercentile()); }
@Test public void testSnapshotMin() throws Exception { Assert.assertEquals(0, globalTimer.getSnapshot().getMin()); }
@Test public void testSnapshot98thPercentile() throws Exception { TestUtils.assertEqualsWithTolerance(980, globalTimer.getSnapshot().get98thPercentile()); }
@Test public void testSnapshot99thPercentile() throws Exception { TestUtils.assertEqualsWithTolerance(980, globalTimer.getSnapshot().get99thPercentile()); }
@Test public void testSnapshotMax() throws Exception { Assert.assertEquals(990, globalTimer.getSnapshot().getMax()); }
@Test public void testSnapshotStdDev() throws Exception { TestUtils.assertEqualsWithTolerance(294.3, globalTimer.getSnapshot().getStdDev()); }
@Test public void testSnapshotSize() throws Exception { Assert.assertEquals(200, globalTimer.getSnapshot().size()); } }
@Test public void testSnapshot75thPercentile() throws Exception { TestUtils.assertEqualsWithTolerance(750, globalTimer.getSnapshot().get75thPercentile()); }
@Test public void testSnapshot95thPercentile() throws Exception { TestUtils.assertEqualsWithTolerance(960, globalTimer.getSnapshot().get95thPercentile()); }
@Test public void testSnapshotMean() throws Exception { TestUtils.assertEqualsWithTolerance(506.3, globalTimer.getSnapshot().getMean()); }
@Test @InSequence(3) public void testTimerRegistry() throws Exception { String timerLongName = "test.longData.timer"; String timerTimeName = "testTime"; SortedMap<String, Timer> timers = registry.getTimers(); Assert.assertTrue(timers.size() > 0); Assert.assertTrue(timers.containsKey(timerLongName)); Assert.assertTrue(timers.containsKey(timerTimeName)); TestUtils.assertEqualsWithTolerance(480, timers.get(timerLongName).getSnapshot().getValue(0.5)); }
} else if(metric instanceof Timer) { Timer timer = (Timer)metric; Snapshot snapshot = timer.getSnapshot(); json.writeStartObject(); json.writeObjectField("count", timer.getCount());
.append(value(registryKey, keyBase + "_five_min_rate_per_second", timer.getFiveMinuteRate(), entry.metadata)) .append(value(registryKey, keyBase + "_fifteen_min_rate_per_second", timer.getFifteenMinuteRate(), entry.metadata)) .append(toPrometheus(registryKey, keyBase, keyUnit, timer.getSnapshot(), entry.metadata));