Class TimerGauge

  • All Implemented Interfaces:
    org.apache.flink.metrics.Gauge<Long>, org.apache.flink.metrics.Metric, org.apache.flink.metrics.View

    public class TimerGauge
    extends Object
    implements org.apache.flink.metrics.Gauge<Long>, org.apache.flink.metrics.View
    TimerGauge measures how much time is spent in a given state, with entry into that state being signaled by markStart(). Measuring is stopped by markEnd(). This class in particularly takes care of the case, when update() is called when some measurement started but has not yet finished. For example even if next markEnd() call is expected to happen in a couple of hours, the returned value will account for this ongoing measurement.
    • Constructor Detail

      • TimerGauge

        public TimerGauge()
      • TimerGauge

        public TimerGauge​(int timeSpanInSeconds)
      • TimerGauge

        public TimerGauge​(org.apache.flink.util.clock.Clock clock)
      • TimerGauge

        public TimerGauge​(org.apache.flink.util.clock.Clock clock,
                          int timeSpanInSeconds)
    • Method Detail

      • markStart

        public void markStart()
      • markEnd

        public void markEnd()
      • update

        public void update()
        Specified by:
        update in interface org.apache.flink.metrics.View
      • getValue

        public Long getValue()
        Specified by:
        getValue in interface org.apache.flink.metrics.Gauge<Long>
      • getMaxSingleMeasurement

        public long getMaxSingleMeasurement()
        Returns:
        the longest marked period as measured by the given * TimerGauge. For example the longest consecutive back pressured period.
      • getAccumulatedCount

        public long getAccumulatedCount()
        Returns:
        the accumulated period by the given * TimerGauge.
      • getCount

        @VisibleForTesting
        public long getCount()
      • isMeasuring

        @VisibleForTesting
        public boolean isMeasuring()