Class TxnLogBufferedWriterMetricsStats

java.lang.Object
org.apache.pulsar.transaction.coordinator.impl.TxnLogBufferedWriterMetricsStats
All Implemented Interfaces:
Closeable, AutoCloseable
Direct Known Subclasses:
DisabledTxnLogBufferedWriterMetricsStats

public class TxnLogBufferedWriterMetricsStats extends Object implements Closeable
Describes the working status of the TxnLogBufferedWriter, helps users tune the thresholds of TxnLogBufferedWriter for best performance. Note-1: When batch feature is turned off, no data is logged at this. In this scenario,users can see the ManagedLedgerMXBean. Note-2: Even if enable batch feature. A batch has numerous triggers. The metrics in this class count each type of trigger to allow you to diagnose what mostly causing a batch flush. The metric also includes a histogram for delay of batch since 1st record entered, the size of batch in bytes number of records in batch. This will help you to tune the parameters that control some of the batch flush triggers: maxDelay, maxRecords, maxSize. Note that the 4th trigger - a single record larger than batch size - triggers a flush of the current batch, but the big record itself is not written in batch hence is not included in the batch metrics written above (batch size, batch delay, etc). The trigger is of course counted as other trigger types.
  • Constructor Details

    • TxnLogBufferedWriterMetricsStats

      public TxnLogBufferedWriterMetricsStats(String metricsPrefix, String[] labelNames, String[] labelValues, io.prometheus.client.CollectorRegistry registry)
      Users needs to ensure that the TxnLogBufferedWriterMetricsStats of the same can only create once, otherwise an IllegalArgumentException will be thrown.
  • Method Details

    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • triggerFlushByRecordsCount

      public void triggerFlushByRecordsCount(int recordCount, long bytesSize, long delayMillis)
    • triggerFlushByBytesSize

      public void triggerFlushByBytesSize(int recordCount, long bytesSize, long delayMillis)
    • triggerFlushByByMaxDelay

      public void triggerFlushByByMaxDelay(int recordCount, long bytesSize, long delayMillis)
    • triggerFlushByLargeSingleData

      public void triggerFlushByLargeSingleData(int recordCount, long bytesSize, long delayMillis)