Class ColumnarMetrics
java.lang.Object
io.krabka.streams.columnar.ColumnarMetrics
Lock-free counters for a columnar runner.
Group runners record one observation per logical partition batch. Counters only
grow; readers take consistent-enough views with snapshot() and compute
rates by differencing two snapshots. One instance can be shared by several runners
to aggregate their throughput.
Example
var metrics = new ColumnarMetrics();
var runner = ColumnarRunner.group(
topology, consumer, producer, ColumnarErrorPolicy.fail(),
ColumnarStateStore.none(), metrics);
runner.runOnce(Duration.ofSeconds(1));
var snapshot = metrics.snapshot();
log.info("{} records in {} batches", snapshot.inputRecords(), snapshot.batches());
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordOne point-in-time view of the counters. -
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
ColumnarMetrics
public ColumnarMetrics()Creates a metrics object with all counters at zero.
-
-
Method Details
-
snapshot
Reads all counters into one immutable snapshot.Counters are read individually without a global lock, so a snapshot taken while runners are active may straddle an in-flight batch; totals are still monotonic between snapshots.
- Returns:
- the current counter values
-