Hi Aditya, all,

Thanks for writing this up. +1 to the direction.

I maintain a MetricsReporter that exports producer and consumer
metrics from a large client fleet. We do not use JMX or KIP-714
broker push. We read KafkaMetric values on a ~60s interval and
today only ingest numeric doubles. Fleet-wide p99 over minutes
to hours is the gap -avg/-max cannot fill, so combinable bin
counts are something we would actually use.

A few notes from that setup, including on Nikita's questions.

NS1: metric set
The seven INFO distributions match sensors we already export as
scalars: request-latency, record-queue-time, batch-size,
record-size, compression-ratio, fetch-latency, fetch-size.
Per-client rather than per-node also matches how we group
series. Connection-scoped request-latency would churn for the
life of the process, so the current cut looks right to us.

DEBUG for commit-latency, rebalance-latency,
produce-throttle-time, poll-idle-ratio, and the coordinator
timers seems like a reasonable first cut. We already export
several of those as scalars, but I would not treat promoting
them to INFO as a requirement for this KIP.

The fetch-latency idle cluster around fetch.max.wait.ms, and
request-latency recording 0 under 1 ms, are easy to misread.
Having those spelled out in the KIP is useful for reporters.

NS2: JMX and percentiles
Agreed that this is a custom-reporter feature, and that
JmxReporter should skip it. Client-side Percentiles would not
help our case: a 30s p99 on one client cannot be combined
across the fleet or across windows.

>From a reporter, KafkaMetric.isDistribution(), a
DistributionSnapshot from metricValue(), and minus() /
startTimeMs() are the pieces we would implement against.

NS3: cumulative vs window
Support for cumulative counts plus minus(). We would keep the
previous snapshot in the reporter and export minus(earlier)
each interval. That gives us a window without resetting the
stat, so a second reporter on the same client is not starved.

A lifetime p99 is not useful for us either. The reporter should
own the window. A later startTimeMs is the recreate signal so
we do not subtract across a client restart. A delta-on-read
stat would be worse here, since more than one reporter can be
attached.

NS4: exponential histograms and the cap
Support for fixed geometric edges and one fleet-wide
metrics.distribution.scale. We add buckets across many clients,
which only works if the edges match. Per-process auto scale
would make those queries silently wrong.

Default scale 2 (67 bins for request-latency) is workable as a
recording format. We would not explode every bin into its own
time series. We would either publish the snapshot as one
histogram, or compute p50/p99 from minus() in the reporter and
keep emitting a few doubles. One small suggestion: it would
help reporters like ours if the KIP said that quantile() on a
minus() window is an intended use, not only Prom/OTel _bucket
export.

The 65s cap on latencyMs() looks sufficient for request-latency
and fetch-latency. longLatencyMs() for record-queue-time,
rebalance, and time-between-poll matches delivery.timeout.ms /
max.poll.interval.ms. We would not need an unbounded
exponential histogram for those.

Leaving KIP-714 histogram encoding as a follow-up also works
for us. We are not blocked on it.

Happy to review a prototype against trunk under KAFKA-21361.

Parul Lakhotia
Salesforce

Reply via email to