public void add(double[] values) { for (double d : values) { add(d); } }
public GaugeMetricValueBuilder addPoint(double value) { stats.addValue(value); accum.add(value); return this; }
/** * Create a {@link GaugeMetricValue} from a series of {@link GaugeMetricValue}s. The * resulting value will be a summarization of each individual value. * * @param range The range which represents the aggregated value */ public GaugeMetricValue fromValues(TimeRange range, Collection<GaugeMetricValue> values) { if (values.isEmpty()) { return new GaugeMetricValue(range); } HistogramAccumulator accum = makeHistoAccumulator(); Min min = new Min(); Max max = new Max(); Sum total = new Sum(); Sum n = new Sum(); Sum sumOfSquares = new Sum(); for (GaugeMetricValue v : values) { min.increment(v.getMin()); max.increment(v.getMax()); n.increment(v.getN()); total.increment(v.getSum()); sumOfSquares.increment(v.getSumOfSquares()); accum.add(v.getHistogram()); } return new GaugeMetricValue(range, min.getResult(), max.getResult(), (long)n.getResult(), total.getResult(), sumOfSquares.getResult(), accum.getSparseHistogram()); }