Class PartitionIngestionMonitor

java.lang.Object
com.linkedin.davinci.kafka.consumer.PartitionIngestionMonitor

public class PartitionIngestionMonitor extends Object
Lightweight per-partition metric accumulator using LongAdder for lock-free concurrent recording. Only instantiated when a monitoring session is active for a partition.

All counters use LongAdder where increment/add operations are ~10-20ns with no contention. Latency tracking uses sum+count pairs (not histograms) to minimize overhead. snapshotAndReset(long) atomically reads and resets all counters via sumThenReset(), computes rates and averages, and returns a PartitionIngestionSnapshot POJO.

Minor temporal smearing at reset boundaries is acceptable for a monitoring tool.

  • Constructor Details

    • PartitionIngestionMonitor

      public PartitionIngestionMonitor()
  • Method Details

    • recordIngested

      public void recordIngested(int bytes)
      Record an ingested record with its size in bytes.
    • recordLeaderProduced

      public void recordLeaderProduced(long bytes)
      Record a leader-produced record with its size in bytes.
    • recordE2EProcessingLatencyNs

      public void recordE2EProcessingLatencyNs(long nanos)
    • recordLeaderPreprocessingLatencyNs

      public void recordLeaderPreprocessingLatencyNs(long nanos)
    • recordLeaderProduceLatencyNs

      public void recordLeaderProduceLatencyNs(long nanos)
    • recordLeaderCompletionLatencyNs

      public void recordLeaderCompletionLatencyNs(long nanos)
    • recordLeaderCallbackLatencyNs

      public void recordLeaderCallbackLatencyNs(long nanos)
    • recordStoragePutLatencyNs

      public void recordStoragePutLatencyNs(long nanos)
    • recordValueLookupLatencyNs

      public void recordValueLookupLatencyNs(long nanos)
    • recordRmdLookupLatencyNs

      public void recordRmdLookupLatencyNs(long nanos)
    • snapshotAndReset

      public PartitionIngestionSnapshot snapshotAndReset(long elapsedMs)
      Atomically reads and resets all counters, computes rates and averages, and returns a PartitionIngestionSnapshot.
      Parameters:
      elapsedMs - the elapsed time in milliseconds since the last snapshot
      Returns:
      snapshot with computed rates and averages