#31259·scylladb

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 = 1

Current 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 3

Expected 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:

https://github.com/scylladb/scylladb/blob/fe679915cd1c32ad56ac0f8740b44703f1722e7b/alternator/executor_read.cc#L1903-L1926

The grouped map size is used for batch size:

https://github.com/scylladb/scylladb/blob/fe679915cd1c32ad56ac0f8740b44703f1722e7b/alternator/executor_read.cc#L1928-L1944

That value feeds global totals and histograms and the per-table histogram, while no per-table total is updated:

https://github.com/scylladb/scylladb/blob/fe679915cd1c32ad56ac0f8740b44703f1722e7b/alternator/executor_read.cc#L1947-L1962