Search in sources :

Example 1 with Snapshot

use of com.yammer.metrics.stats.Snapshot in project netty by netty.

the class CustomReporter method processTimer.

@Override
public void processTimer(final MetricName name, final Timer timer, final PrintStream stream) {
    processMeter(name, timer, stream);
    final String durationUnit = abbrev(timer.durationUnit());
    final Snapshot snapshot = timer.getSnapshot();
    stream.printf(locale, "               min = %,2.2f %s\n", timer.min(), durationUnit);
    stream.printf(locale, "               max = %,2.2f %s\n", timer.max(), durationUnit);
    stream.printf(locale, "              mean = %,2.2f %s\n", timer.mean(), durationUnit);
    stream.printf(locale, "            stddev = %,2.2f %s\n", timer.stdDev(), durationUnit);
    stream.printf(locale, "            median = %,2.2f %s\n", snapshot.getMedian(), durationUnit);
    stream.printf(locale, "              75%% <= %,2.2f %s\n", snapshot.get75thPercentile(), durationUnit);
    stream.printf(locale, "              95%% <= %,2.2f %s\n", snapshot.get95thPercentile(), durationUnit);
    stream.printf(locale, "              98%% <= %,2.2f %s\n", snapshot.get98thPercentile(), durationUnit);
    stream.printf(locale, "              99%% <= %,2.2f %s\n", snapshot.get99thPercentile(), durationUnit);
    stream.printf(locale, "            99.9%% <= %,2.2f %s\n", snapshot.get999thPercentile(), durationUnit);
}
Also used : Snapshot(com.yammer.metrics.stats.Snapshot)

Example 2 with Snapshot

use of com.yammer.metrics.stats.Snapshot in project pinot by linkedin.

the class AggregatedHistogram method refresh.

/**
   * update all stats using underlying histograms
   */
public void refresh() {
    List<Double> values = new ArrayList<Double>();
    _min = Double.MAX_VALUE;
    _max = Double.MIN_VALUE;
    _sum = 0;
    double meanSum = 0.0;
    for (T hist : _histograms) {
        if (hist instanceof Histogram) {
            Histogram h = (Histogram) hist;
            _min = Math.min(_min, h.min());
            _max = Math.max(_max, h.max());
            _sum += h.sum();
            meanSum += h.mean();
        } else {
            AggregatedHistogram<Sampling> h = (AggregatedHistogram<Sampling>) hist;
            _min = Math.min(_min, h.min());
            _max = Math.max(_max, h.max());
            _sum += h.sum();
            meanSum += h.mean();
        }
        double[] val = hist.getSnapshot().getValues();
        for (double d : val) {
            values.add(d);
        }
    }
    if (!_histograms.isEmpty()) {
        _mean = meanSum / _histograms.size();
    }
    if (!values.isEmpty()) {
        double[] vals = new double[values.size()];
        int i = 0;
        for (Double d : values) {
            vals[i++] = d;
        }
        _snapshot = new Snapshot(vals);
    }
}
Also used : Snapshot(com.yammer.metrics.stats.Snapshot) Histogram(com.yammer.metrics.core.Histogram) ArrayList(java.util.ArrayList) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) Sampling(com.yammer.metrics.core.Sampling)

Example 3 with Snapshot

use of com.yammer.metrics.stats.Snapshot in project netty by netty.

the class CustomReporter method processHistogram.

@Override
public void processHistogram(final MetricName name, final Histogram histogram, final PrintStream stream) {
    final Snapshot snapshot = histogram.getSnapshot();
    stream.printf(locale, "               min = %,2.2f\n", histogram.min());
    stream.printf(locale, "               max = %,2.2f\n", histogram.max());
    stream.printf(locale, "              mean = %,2.2f\n", histogram.mean());
    stream.printf(locale, "            stddev = %,2.2f\n", histogram.stdDev());
    stream.printf(locale, "            median = %,2.2f\n", snapshot.getMedian());
    stream.printf(locale, "              75%% <= %,2.2f\n", snapshot.get75thPercentile());
    stream.printf(locale, "              95%% <= %,2.2f\n", snapshot.get95thPercentile());
    stream.printf(locale, "              98%% <= %,2.2f\n", snapshot.get98thPercentile());
    stream.printf(locale, "              99%% <= %,2.2f\n", snapshot.get99thPercentile());
    stream.printf(locale, "            99.9%% <= %,2.2f\n", snapshot.get999thPercentile());
}
Also used : Snapshot(com.yammer.metrics.stats.Snapshot)

Example 4 with Snapshot

use of com.yammer.metrics.stats.Snapshot in project platformlayer by platformlayer.

the class PlatformlayerMetricsReporter method sendSampling.

protected void sendSampling(MetricTreeObject subtree, Sampling metric) throws IOException {
    final Snapshot snapshot = metric.getSnapshot();
    subtree.addFloat("median", snapshot.getMedian());
    subtree.addFloat("75percentile", snapshot.get75thPercentile());
    subtree.addFloat("95percentile", snapshot.get95thPercentile());
    subtree.addFloat("98percentile", snapshot.get98thPercentile());
    subtree.addFloat("99percentile", snapshot.get99thPercentile());
    subtree.addFloat("999percentile", snapshot.get999thPercentile());
}
Also used : Snapshot(com.yammer.metrics.stats.Snapshot)

Aggregations

Snapshot (com.yammer.metrics.stats.Snapshot)4 Histogram (com.yammer.metrics.core.Histogram)1 Sampling (com.yammer.metrics.core.Sampling)1 ArrayList (java.util.ArrayList)1 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1