Package org.apache.flink.runtime.metrics
Class TimerGauge
java.lang.Object
org.apache.flink.runtime.metrics.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.-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from interface org.apache.flink.metrics.View
UPDATE_INTERVAL_SECONDS -
Constructor Summary
ConstructorsConstructorDescriptionTimerGauge(int timeSpanInSeconds) TimerGauge(org.apache.flink.util.clock.Clock clock) TimerGauge(org.apache.flink.util.clock.Clock clock, int timeSpanInSeconds) -
Method Summary
Modifier and TypeMethodDescriptionlonglonggetCount()longgetValue()booleanvoidmarkEnd()voidvoidregisterListener(TimerGauge.StartStopListener listener) voidvoidupdate()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.flink.metrics.Gauge
getMetricType
-
Constructor Details
-
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 Details
-
registerListener
-
unregisterListener
-
markStart
public void markStart() -
markEnd
public void markEnd() -
update
public void update()- Specified by:
updatein interfaceorg.apache.flink.metrics.View
-
getValue
- Specified by:
getValuein interfaceorg.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()
-