@Around( value = "(execution(@HistogramMetric * * (..)) || initialization(@HistogramMetric new(..))) && @annotation(histogramMetric)", argNames = "thisJoinPoint, histogramMetric") public Object aroundHistogramMetricMethod( ProceedingJoinPoint thisJoinPoint, HistogramMetric histogramMetric) throws Throwable { return engage( thisJoinPoint, histogramMetric.value(), histogramMetric.alias(), Metrics.buildHistogram(histogramMetric.samples())); }
/** * Returns a list of all recorded durations in the timer's sample. * * @return a list of all recorded durations in the timer's sample */ public List<Double> values() { final List<Double> values = new ArrayList<Double>(); for (Long value : histogram.values()) { values.add(convertFromNS(value)); } return values; }
/** * Returns an array of durations at the given percentiles. * * @param percentiles one or more percentiles ({@code 0..1}) * @return an array of durations at the given percentiles */ public double[] percentiles(double... percentiles) { final double[] scores = histogram.percentiles(percentiles); for (int i = 0; i < scores.length; i++) { scores[i] = convertFromNS(scores[i]); } return scores; }
@Override public long count() { return histogram.count(); }
/** Clears all recorded durations. */ public void clear() { histogram.clear(); }
private void update(long duration) { if (duration >= 0) { histogram.update(duration); meter.mark(); } }
/** * Returns the standard deviation of all recorded durations. * * @return the standard deviation of all recorded durations */ public double stdDev() { return convertFromNS(histogram.stdDev()); }
/** * Returns the arithmetic mean of all recorded durations. * * @return the arithmetic mean of all recorded durations */ public double mean() { return convertFromNS(histogram.mean()); }