Status

Current stateAccepted

Discussion threadhttp://mail-archives.apache.org/mod_mbox/kafka-dev/201907.mbox/%3CCAAyirGtNhLb8YnmmAUgiwQcjSP-mYCMEsB7dAVK6mqQDVdnwLg%40mail.gmail.com%3E

JIRA

Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).

Motivation

Kafka has a family of metrics consisting of:

These metrics are all related to each other, but their relationship is obscure (and one is redundant) (and another is internal).

I've recently been involved in a third  recapitulation of trying to work out which metric does what. It seems like it's time to clean up the mess and save everyone from having to work out the mystery for themselves.

Public Interfaces

The affected public interfaces are:

sampled count metric:

sampled sum metric:

non-sampled count metric:

non-sampled sum metric:

Proposed Changes

The existing metrics cover four quadrants of a matrix:


countsum
sampledCount

SampledTotal

Sum

non-sampled(internal) CumulativeCount

Total

It's immediately apparent that there's no consistency in naming, that there's a missing quadrant, and that one quadrant is redundantly covered.

The proposal is simple:


countsum
sampledWindowedCount

WindowedSum

non-sampledCumulativeCount

CumulativeSum

Under this proposal, the metrics are clearly and regularly named and all quadrants are covered uniquely. There is no ambiguity in the names, and the structure of the names also indicate a pattern that would guide users to select the correct metric for their needs.

Compatibility, Deprecation, and Migration Plan

Existing metrics are deprecated in favor of unambiguously named ones. They will be made to subclass the new metrics to avoid code duplication, but this won't cause any code compatibility issues, since they'll still inherit the same interfaces.

Rejected Alternatives