public MutableGaugeMetricValue(TimeRange timeRange) { this.range = timeRange; this.histo = new HistogramAccumulator(InsightGaugeHistogramDefinition.getInstance()); }
public void add(double[] values) { for (double d : values) { add(d); } }
/** * Get the count of objects within the given bin. */ public long get(int binNumber) { return getOrCreateBin(binNumber).get(); }
/** * 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()); }
public MetricValue getMetricValue() { return new GaugeMetricValue(range, min, max, n, sum, sumOfSquares, histo.getSparseHistogram()); }
public void addHistogramEntry(int binNum, long count) { histo.incrementBin(binNum, count); }
public GaugeMetricValue build() { return new GaugeMetricValue(valueRange, stats.getMin(), stats.getMax(), stats.getN(), Double.isNaN(stats.getSum()) ? 0.0 : stats.getSum(), Double.isNaN(stats.getSumsq()) ? 0.0 : stats.getSumsq(), accum.getSparseHistogram()); } }
public void incrementBin(int binNum, long incr) { MutableLong bin = getOrCreateBin(binNum); bin.increment(incr); }
static private HistogramAccumulator makeHistoAccumulator() { return new HistogramAccumulator(InsightGaugeHistogramDefinition.getInstance()); } }
public GaugeMetricValueBuilder addPoint(double value) { stats.addValue(value); accum.add(value); return this; }
/** * Add the given value to the histogram. */ public void add(double value) { int binNum = def.getBinForValue(value); MutableLong bin = getOrCreateBin(binNum); bin.increment(1); }
public GaugeMetricValueBuilder(TimeRange timeRange){ this(timeRange, new HistogramAccumulator(InsightGaugeHistogramDefinition.getInstance()), new SummaryStatistics()); }
/** * Add all data from another histogram into this accumulator. The passed * histogram must be created against the same {@link HistogramDefinition} as * any other histograms passed into this accumulator. */ public void add(SparseHistogram histo) { for (IndexedBin addBin : histo.getBins()) { MutableLong bin = getOrCreateBin(addBin.getBinNumber()); bin.increment(addBin.getCount()); } }