alternator: BatchGetItem item metrics count partitions instead of requested keys
Author: dkropachevCreated Aug 25, 2026Updated Sep 16, 2026
Labelsbugarea/alternatorai-assisted
Problem
BatchGetItem groups requested keys by partition for execution, then uses the grouped map size as the batch-item count. This measures distinct partitions rather than requested keys. The per-table batch-item total is not incremented at all.
For three clustering keys sharing one partition key:
Requested items N = 3
Grouped partitions P = 1Current behavior
global batch_item_count +1 # should be +3
table batch_item_count +0 # should be +3
global histogram observes 1 # should observe 3
table histogram observes 1 # should observe 3Expected behavior
Batch-item totals and histograms should represent the number of validated and authorized keys requested by the client, not internal partition grouping.
Impact
- Item throughput is underreported.
- Batch-size histograms make requests look smaller.
- Per-table item throughput appears empty.
- Global and table dashboards cannot be reconciled.
- Metrics describe internal execution grouping instead of client workload.
Code references
Requested keys are grouped by partition:
The grouped map size is used for batch size:
That value feeds global totals and histograms and the per-table histogram, while no per-table total is updated:
Source: scylladb/scylladb