Search in sources :

Example 6 with Snapshot

use of io.dropwizard.metrics.Snapshot in project light-4j by networknt.

the class UniformSnapshotTest method calculatesAStdDevOfZeroForASingletonSnapshot.

@Test
public void calculatesAStdDevOfZeroForASingletonSnapshot() throws Exception {
    final Snapshot singleItemSnapshot = new UniformSnapshot(new long[] { 1 });
    assertThat(singleItemSnapshot.getStdDev()).isZero();
}
Also used : Snapshot(io.dropwizard.metrics.Snapshot) UniformSnapshot(io.dropwizard.metrics.UniformSnapshot) UniformSnapshot(io.dropwizard.metrics.UniformSnapshot) Test(org.junit.Test)

Example 7 with Snapshot

use of io.dropwizard.metrics.Snapshot in project light-4j by networknt.

the class WeightedSnapshotTest method calculatesAStdDevOfZeroForASingletonSnapshot.

@Test
public void calculatesAStdDevOfZeroForASingletonSnapshot() throws Exception {
    final Snapshot singleItemSnapshot = new WeightedSnapshot(WeightedArray(new long[] { 1 }, new double[] { 1.0 }));
    assertThat(singleItemSnapshot.getStdDev()).isZero();
}
Also used : Snapshot(io.dropwizard.metrics.Snapshot) WeightedSnapshot(io.dropwizard.metrics.WeightedSnapshot) WeightedSnapshot(io.dropwizard.metrics.WeightedSnapshot) Test(org.junit.Test)

Example 8 with Snapshot

use of io.dropwizard.metrics.Snapshot in project light-4j by networknt.

the class WeightedSnapshotTest method calculatesAStdDevOfZeroForAnEmptySnapshot.

@Test
public void calculatesAStdDevOfZeroForAnEmptySnapshot() throws Exception {
    final Snapshot emptySnapshot = new WeightedSnapshot(WeightedArray(new long[] {}, new double[] {}));
    assertThat(emptySnapshot.getStdDev()).isZero();
}
Also used : Snapshot(io.dropwizard.metrics.Snapshot) WeightedSnapshot(io.dropwizard.metrics.WeightedSnapshot) WeightedSnapshot(io.dropwizard.metrics.WeightedSnapshot) Test(org.junit.Test)

Example 9 with Snapshot

use of io.dropwizard.metrics.Snapshot in project light-4j by networknt.

the class WeightedSnapshotTest method calculatesAMinOfZeroForAnEmptySnapshot.

@Test
public void calculatesAMinOfZeroForAnEmptySnapshot() throws Exception {
    final Snapshot emptySnapshot = new WeightedSnapshot(WeightedArray(new long[] {}, new double[] {}));
    assertThat(emptySnapshot.getMin()).isZero();
}
Also used : Snapshot(io.dropwizard.metrics.Snapshot) WeightedSnapshot(io.dropwizard.metrics.WeightedSnapshot) WeightedSnapshot(io.dropwizard.metrics.WeightedSnapshot) Test(org.junit.Test)

Example 10 with Snapshot

use of io.dropwizard.metrics.Snapshot in project light-4j by networknt.

the class WeightedSnapshotTest method expectNoOverflowForLowWeights.

@Test
public void expectNoOverflowForLowWeights() throws Exception {
    final Snapshot scatteredSnapshot = new WeightedSnapshot(WeightedArray(new long[] { 1, 2, 3 }, new double[] { Double.MIN_VALUE, Double.MIN_VALUE, Double.MIN_VALUE }));
    assertThat(scatteredSnapshot.getMean()).isEqualTo(2);
}
Also used : Snapshot(io.dropwizard.metrics.Snapshot) WeightedSnapshot(io.dropwizard.metrics.WeightedSnapshot) WeightedSnapshot(io.dropwizard.metrics.WeightedSnapshot) Test(org.junit.Test)

Aggregations

Snapshot (io.dropwizard.metrics.Snapshot)33 Test (org.junit.Test)28 WeightedSnapshot (io.dropwizard.metrics.WeightedSnapshot)8 UniformSnapshot (io.dropwizard.metrics.UniformSnapshot)6 Histogram (io.dropwizard.metrics.Histogram)4 Timer (io.dropwizard.metrics.Timer)4 InfluxDbPoint (io.dropwizard.metrics.influxdb.data.InfluxDbPoint)4 ExponentiallyDecayingReservoir (io.dropwizard.metrics.ExponentiallyDecayingReservoir)3 WeightedSample (io.dropwizard.metrics.WeightedSnapshot.WeightedSample)2 UniformReservoir (io.dropwizard.metrics.UniformReservoir)1 Before (org.junit.Before)1