use of com.codahale.metrics.Snapshot in project cassandra by apache.
the class BatchMetricsTableTest method testSelectAll.
@Test
public void testSelectAll() throws Throwable {
BatchMetrics metrics = BatchStatement.metrics;
for (int i = 0; i < 10; i++) {
metrics.partitionsPerLoggedBatch.update(i);
metrics.partitionsPerUnloggedBatch.update(i + 10);
metrics.partitionsPerCounterBatch.update(i * 10);
}
ResultSet result = executeNet(format("SELECT * FROM %s.batch_metrics", KS_NAME));
assertEquals(5, result.getColumnDefinitions().size());
AtomicInteger rowCount = new AtomicInteger(0);
result.forEach(r -> {
Snapshot snapshot = getExpectedHistogram(metrics, r.getString("name")).getSnapshot();
assertEquals(snapshot.getMedian(), r.getDouble("p50th"), 0.0);
assertEquals(snapshot.get99thPercentile(), r.getDouble("p99th"), 0.0);
rowCount.addAndGet(1);
});
assertEquals(3, rowCount.get());
}
use of com.codahale.metrics.Snapshot in project cassandra by apache.
the class DecayingEstimatedHistogramReservoirTest method testMinMax.
@Test
public void testMinMax() {
DecayingEstimatedHistogramReservoir histogram = new DecayingEstimatedHistogramReservoir();
histogram.update(16);
Snapshot snapshot = histogram.getSnapshot();
assertEquals(15, snapshot.getMin());
assertEquals(17, snapshot.getMax());
}
use of com.codahale.metrics.Snapshot in project storm by apache.
the class Executor method processTimers.
private void processTimers(int taskId, List<IMetricsConsumer.DataPoint> dataPoints) {
Map<String, Timer> timers = workerData.getMetricRegistry().getTaskTimers(taskId);
for (Map.Entry<String, Timer> entry : timers.entrySet()) {
Snapshot snapshot = entry.getValue().getSnapshot();
addSnapshotDatapoints(entry.getKey(), snapshot, dataPoints);
addMeteredDatapoints(entry.getKey(), entry.getValue(), dataPoints);
}
}
use of com.codahale.metrics.Snapshot in project storm by apache.
the class Executor method processHistograms.
private void processHistograms(int taskId, List<IMetricsConsumer.DataPoint> dataPoints) {
Map<String, Histogram> histograms = workerData.getMetricRegistry().getTaskHistograms(taskId);
for (Map.Entry<String, Histogram> entry : histograms.entrySet()) {
Snapshot snapshot = entry.getValue().getSnapshot();
addSnapshotDatapoints(entry.getKey(), snapshot, dataPoints);
IMetricsConsumer.DataPoint dataPoint = new IMetricsConsumer.DataPoint(entry.getKey() + ".count", entry.getValue().getCount());
dataPoints.add(dataPoint);
}
}
use of com.codahale.metrics.Snapshot in project samza by apache.
the class SamzaHistogram method update.
synchronized void update(long value) {
histogram.update(value);
Snapshot values = histogram.getSnapshot();
percentiles.forEach(x -> gauges.get(x).set(values.getValue(x / 100)));
}
Aggregations