Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
titleCreating Rate Metrics
metricName = metrics.metricName("request-rate", metricGrpName, "The average number of requests sent per second.", metricTags);
totalMetricName = metrics.metricName("request-total", metricGrpName, "The total number of requests sent.", metricTags);
this.bytesSent.add(new Rate(new Count(), metricName, totalMetricName));


 

Rate would be a CompoundStat that returns both total and the existing rate metrics. This is already handled correctly to support Percentiles. The two metrics appear as two Attributes.

Code Block
languagejava
titleMetrics from Rate as a CompoundStat
 @Override
 public List<NamedMeasurable> stats() {
    List<NamedMeasurable> stats = new ArrayList<NamedMeasurable>(2);
    stats.add(new NamedMeasurable(totalMetricName, total));
    stats.add(new NamedMeasurable(rateMetricName, rate));
    return stats;
}

 

Compatibility, Deprecation, and Migration Plan

...