Versions Compared

Key

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

...

[put | put-if-absent | get | delete | put-all | all | range | flush | restore]-rate[put | put-if-absent | get | delete | put-all | all | range | flush | restore]-total


Proposed Changes

A new Stat named org.apache.kafka.common.metrics.stats.RateMeter will be added which will be converted to a CompoundStat similar to Percentiles, with two metrics: rate and total (e.g. request-rate and request-total). For consistency, metrics like io-wait-ratio which specify time ratio will also have two attributes (e.g. io-wait-ratio and io-wait-time-total).

...

Code Block
languagejava
titleCreating Rate Metrics
metricNamerateMetricName = 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 RateMeter(new Count(), metricNamerateMetricName, totalMetricName));


 

Rate Meter 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 Meter 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;
}

...