use of io.dropwizard.metrics.Snapshot in project light-4j by networknt.
the class WeightedSnapshotTest method worksWithUnderestimatedCollections.
@Test
public void worksWithUnderestimatedCollections() throws Exception {
final List<WeightedSample> items = spy(WeightedArray(new long[] { 5, 1, 2, 3, 4 }, new double[] { 1, 2, 3, 2, 2 }));
when(items.size()).thenReturn(4, 5);
final Snapshot other = new WeightedSnapshot(items);
assertThat(other.getValues()).containsOnly(1, 2, 3, 4, 5);
}
use of io.dropwizard.metrics.Snapshot in project light-4j by networknt.
the class WeightedSnapshotTest method calculatesAMaxOfZeroForAnEmptySnapshot.
@Test
public void calculatesAMaxOfZeroForAnEmptySnapshot() throws Exception {
final Snapshot emptySnapshot = new WeightedSnapshot(WeightedArray(new long[] {}, new double[] {}));
assertThat(emptySnapshot.getMax()).isZero();
}
use of io.dropwizard.metrics.Snapshot in project java by wavefrontHQ.
the class WavefrontReporter method reportTimer.
private void reportTimer(MetricName name, Timer timer, long timestamp, Map<String, String> combinedTags) throws IOException {
final Snapshot snapshot = timer.getSnapshot();
wavefront.send(prefix(name, "max"), convertDuration(snapshot.getMax()), timestamp, source, combinedTags);
wavefront.send(prefix(name, "mean"), convertDuration(snapshot.getMean()), timestamp, source, combinedTags);
wavefront.send(prefix(name, "min"), convertDuration(snapshot.getMin()), timestamp, source, combinedTags);
wavefront.send(prefix(name, "stddev"), convertDuration(snapshot.getStdDev()), timestamp, source, combinedTags);
wavefront.send(prefix(name, "p50"), convertDuration(snapshot.getMedian()), timestamp, source, combinedTags);
wavefront.send(prefix(name, "p75"), convertDuration(snapshot.get75thPercentile()), timestamp, source, combinedTags);
wavefront.send(prefix(name, "p95"), convertDuration(snapshot.get95thPercentile()), timestamp, source, combinedTags);
wavefront.send(prefix(name, "p98"), convertDuration(snapshot.get98thPercentile()), timestamp, source, combinedTags);
wavefront.send(prefix(name, "p99"), convertDuration(snapshot.get99thPercentile()), timestamp, source, combinedTags);
wavefront.send(prefix(name, "p999"), convertDuration(snapshot.get999thPercentile()), timestamp, source, combinedTags);
reportMetered(name, timer, timestamp, combinedTags);
}
Aggregations