Package org.apache.flink.metrics
Class MeterView
- java.lang.Object
-
- org.apache.flink.metrics.MeterView
-
@Internal public class MeterView extends Object implements Meter, View
A MeterView provides an average rate of events per second over a given time period.The primary advantage of this class is that the rate is neither updated by the computing thread nor for every event. Instead, a history of counts is maintained that is updated in regular intervals by a background thread. From this history a rate is derived on demand, which represents the average rate of events over the given time span.
Setting the time span to a low value reduces memory-consumption and will more accurately report short-term changes. The minimum value possible is
View.UPDATE_INTERVAL_SECONDS
. A high value in turn increases memory-consumption, since a longer history has to be maintained, but will result in smoother transitions between rates.The events are counted by a
Counter
.
-
-
Field Summary
-
Fields inherited from interface org.apache.flink.metrics.View
UPDATE_INTERVAL_SECONDS
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getCount()
Get number of events marked on the meter.double
getRate()
Returns the current rate of events per second.void
markEvent()
Mark occurrence of an event.void
markEvent(long n)
Mark occurrence of multiple events.void
update()
This method will be called regularly to update the metric.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.metrics.Meter
getMetricType
-
-
-
-
Method Detail
-
markEvent
public void markEvent()
Description copied from interface:Meter
Mark occurrence of an event.
-
markEvent
public void markEvent(long n)
Description copied from interface:Meter
Mark occurrence of multiple events.
-
getCount
public long getCount()
Description copied from interface:Meter
Get number of events marked on the meter.
-
getRate
public double getRate()
Description copied from interface:Meter
Returns the current rate of events per second.
-
-