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)));
}
use of com.codahale.metrics.Snapshot in project samza by apache.
the class SamzaHistogram method updateGaugeValues.
public void updateGaugeValues(double percentile) {
Snapshot values = histogram.getSnapshot();
gauges.get(percentile).set(values.getValue(percentile / 100));
}
use of com.codahale.metrics.Snapshot in project jstorm by alibaba.
the class TopologyMetricContext method mergeHistograms.
/**
* histograms are sampled, but we just update points
*/
public void mergeHistograms(MetricInfo metricInfo, String meta, Map<Integer, MetricSnapshot> data, Map<String, Integer> metaCounters, Map<String, Map<Integer, Histogram>> histograms) {
Map<Integer, MetricSnapshot> existing = metricInfo.get_metrics().get(meta);
if (existing == null) {
metricInfo.put_to_metrics(meta, data);
Map<Integer, Histogram> histogramMap = new HashMap<>();
for (Map.Entry<Integer, MetricSnapshot> dataEntry : data.entrySet()) {
Histogram histogram = MetricUtils.metricSnapshot2Histogram(dataEntry.getValue());
histogramMap.put(dataEntry.getKey(), histogram);
}
histograms.put(meta, histogramMap);
} else {
for (Map.Entry<Integer, MetricSnapshot> dataEntry : data.entrySet()) {
Integer win = dataEntry.getKey();
MetricSnapshot snapshot = dataEntry.getValue();
MetricSnapshot old = existing.get(win);
if (old == null) {
existing.put(win, snapshot);
histograms.get(meta).put(win, MetricUtils.metricSnapshot2Histogram(snapshot));
} else {
if (snapshot.get_ts() >= old.get_ts()) {
old.set_ts(snapshot.get_ts());
Histogram histogram = histograms.get(meta).get(win);
Snapshot updateSnapshot = histogram.getSnapshot();
if (updateSnapshot instanceof JAverageSnapshot) {
sumMetricSnapshot(((JAverageSnapshot) updateSnapshot).getMetricSnapshot(), snapshot);
} else {
// update points
MetricUtils.updateHistogramPoints(histogram, snapshot.get_points(), snapshot.get_pointSize());
}
}
}
}
}
updateMetricCounters(meta, metaCounters);
}
Aggregations