예제 #1
0
  @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()));
  }
예제 #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;
 }
예제 #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;
  }
예제 #4
0
 @Override
 public long count() {
   return histogram.count();
 }
예제 #5
0
 /** Clears all recorded durations. */
 public void clear() {
   histogram.clear();
 }
예제 #6
0
 private void update(long duration) {
   if (duration >= 0) {
     histogram.update(duration);
     meter.mark();
   }
 }
예제 #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());
 }
예제 #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());
 }