@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()));
  }
Esempio n. 2
0
 /**
  * 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;
 }
Esempio n. 3
0
  /**
   * 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;
  }
Esempio n. 4
0
 @Override
 public long count() {
   return histogram.count();
 }
Esempio n. 5
0
 /** Clears all recorded durations. */
 public void clear() {
   histogram.clear();
 }
Esempio n. 6
0
 private void update(long duration) {
   if (duration >= 0) {
     histogram.update(duration);
     meter.mark();
   }
 }
Esempio n. 7
0
 /**
  * Returns the standard deviation of all recorded durations.
  *
  * @return the standard deviation of all recorded durations
  */
 public double stdDev() {
   return convertFromNS(histogram.stdDev());
 }
Esempio n. 8
0
 /**
  * Returns the arithmetic mean of all recorded durations.
  *
  * @return the arithmetic mean of all recorded durations
  */
 public double mean() {
   return convertFromNS(histogram.mean());
 }