use of com.codahale.metrics.Snapshot in project java by wavefrontHQ.
the class WavefrontReporter method reportTimer.
private void reportTimer(String name, Timer timer) throws IOException {
final Snapshot snapshot = timer.getSnapshot();
final long time = clock.getTime() / 1000;
wavefront.send(prefixAndSanitize(name, "max"), convertDuration(snapshot.getMax()), time, source, pointTags);
wavefront.send(prefixAndSanitize(name, "mean"), convertDuration(snapshot.getMean()), time, source, pointTags);
wavefront.send(prefixAndSanitize(name, "min"), convertDuration(snapshot.getMin()), time, source, pointTags);
wavefront.send(prefixAndSanitize(name, "stddev"), convertDuration(snapshot.getStdDev()), time, source, pointTags);
wavefront.send(prefixAndSanitize(name, "p50"), convertDuration(snapshot.getMedian()), time, source, pointTags);
wavefront.send(prefixAndSanitize(name, "p75"), convertDuration(snapshot.get75thPercentile()), time, source, pointTags);
wavefront.send(prefixAndSanitize(name, "p95"), convertDuration(snapshot.get95thPercentile()), time, source, pointTags);
wavefront.send(prefixAndSanitize(name, "p98"), convertDuration(snapshot.get98thPercentile()), time, source, pointTags);
wavefront.send(prefixAndSanitize(name, "p99"), convertDuration(snapshot.get99thPercentile()), time, source, pointTags);
wavefront.send(prefixAndSanitize(name, "p999"), convertDuration(snapshot.get999thPercentile()), time, source, pointTags);
reportMetered(name, timer);
}
use of com.codahale.metrics.Snapshot in project java by wavefrontHQ.
the class WavefrontReporter method reportHistogram.
private void reportHistogram(String name, Histogram histogram) throws IOException {
final Snapshot snapshot = histogram.getSnapshot();
final long time = clock.getTime() / 1000;
wavefront.send(prefixAndSanitize(name, "count"), histogram.getCount(), time, source, pointTags);
wavefront.send(prefixAndSanitize(name, "max"), snapshot.getMax(), time, source, pointTags);
wavefront.send(prefixAndSanitize(name, "mean"), snapshot.getMean(), time, source, pointTags);
wavefront.send(prefixAndSanitize(name, "min"), snapshot.getMin(), time, source, pointTags);
wavefront.send(prefixAndSanitize(name, "stddev"), snapshot.getStdDev(), time, source, pointTags);
wavefront.send(prefixAndSanitize(name, "p50"), snapshot.getMedian(), time, source, pointTags);
wavefront.send(prefixAndSanitize(name, "p75"), snapshot.get75thPercentile(), time, source, pointTags);
wavefront.send(prefixAndSanitize(name, "p95"), snapshot.get95thPercentile(), time, source, pointTags);
wavefront.send(prefixAndSanitize(name, "p98"), snapshot.get98thPercentile(), time, source, pointTags);
wavefront.send(prefixAndSanitize(name, "p99"), snapshot.get99thPercentile(), time, source, pointTags);
wavefront.send(prefixAndSanitize(name, "p999"), snapshot.get999thPercentile(), time, source, pointTags);
}
use of com.codahale.metrics.Snapshot in project helix by apache.
the class HistogramDynamicMetric method getAttributeValue.
@Override
public Number getAttributeValue(String attributeName) {
if (!_attributeNameSet.contains(attributeName)) {
return null;
}
String[] attributeNameParts = attributeName.split("\\.");
if (attributeNameParts.length == 2) {
try {
SnapshotAttribute snapshotAttribute = SnapshotAttribute.valueOf(attributeNameParts[1]);
Method getMethod = Snapshot.class.getMethod(snapshotAttribute._getMethodName);
Snapshot snapshot = getMetricObject().getSnapshot();
if (snapshot != null) {
return (Number) getMethod.invoke(snapshot);
}
} catch (Exception ex) {
_logger.error(String.format("Failed to get Snapshot value for attribute: %s", attributeName), ex);
}
} else {
_logger.error(String.format("Invalid attribute name format: %s", attributeName));
}
return null;
}
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());
}
Aggregations