Muralidhar Basani created KAFKA-21754:
-----------------------------------------
Summary: Streams task-level metric `cache-size-bytes-total`
reports one store's cache size instead of the task total
Key: KAFKA-21754
URL: https://issues.apache.org/jira/browse/KAFKA-21754
Project: Kafka
Issue Type: Bug
Components: streams
Reporter: Muralidhar Basani
Assignee: Muralidhar Basani
Fix For: 4.5.0
The DEBUG metric `cache-size-bytes-total` (`stream-task-metrics`) is documented
as "The cache size in bytes accumulated by this task." When a task has more
than one cached store, the value is instead the size of whichever store's cache
changed last.
All `NamedCache`s in a task share one task-level sensor with a single `Value`
stat, and each one records its own `currentSizeBytes` into it in `put`, `evict`
and `delete`. A `Value` stat keeps only the last recorded value.
Also, `NamedCache.clear()` (called on task recycle) sets the size to 0 without
recording it, so the metric keeps its old value.
**Fix:** record the per-task total, for ex: tracked in `ThreadCache`, and
update the metric in `clear()` and `close()`. This will restore the documented
behaviour, and the metric name, tags and level are unchanged.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)