Interface IOStatisticsStore
- All Superinterfaces:
DurationTrackerFactory,IOStatistics,IOStatisticsAggregator,IOStatisticsSetters
- All Known Implementing Classes:
ForwardingIOStatisticsStore
public interface IOStatisticsStore
extends IOStatistics, IOStatisticsSetters, IOStatisticsAggregator, DurationTrackerFactory
Interface of an IOStatistics store intended for
use in classes which track statistics for reporting.
-
Field Summary
Fields inherited from interface org.apache.hadoop.fs.statistics.IOStatistics
MAX_UNSET_VALUE, MIN_UNSET_VALUE -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMaximumSample(String key, long value) Add a maximum sample: if greater than the current value, updates the value.voidaddMeanStatisticSample(String key, long value) Add a sample to the mean statistics.voidaddMinimumSample(String key, long value) Add a minimum sample: if less than the current value, updates the value.default voidAdd a statistics sample as a min, max and mean and count.voidaddTimedOperation(String prefix, long durationMillis) Add a duration to the min/mean/max statistics, using the given prefix and adding a suffix for each specific value.voidaddTimedOperation(String prefix, Duration duration) Add a duration to the min/mean/max statistics, using the given prefix and adding a suffix for each specific value.; increment tha counter whose name == prefix.Get a reference to the atomic instance providing the value for a specific counter.getGaugeReference(String key) Get a reference to the atomic instance providing the value for a specific gauge.Get a reference to the atomic instance providing the value for a specific maximum.getMeanStatistic(String key) Get a reference to the atomic instance providing the value for a specific meanStatistic.Get a reference to the atomic instance providing the value for a specific minimum.default longincrementCounter(String key) Increment a counter by one.longincrementCounter(String key, long value) Increment a counter.longincrementGauge(String key, long value) Increment a gauge.longincrementMaximum(String key, long value) Increment a maximum.longincrementMinimum(String key, long value) Increment a minimum.voidreset()Reset all statistics.Methods inherited from interface org.apache.hadoop.fs.statistics.DurationTrackerFactory
trackDuration, trackDurationMethods inherited from interface org.apache.hadoop.fs.statistics.IOStatistics
counters, gauges, maximums, meanStatistics, minimumsMethods inherited from interface org.apache.hadoop.fs.statistics.IOStatisticsAggregator
aggregateMethods inherited from interface org.apache.hadoop.fs.statistics.IOStatisticsSetters
setCounter, setGauge, setMaximum, setMeanStatistic, setMinimum
-
Method Details
-
incrementCounter
Increment a counter by one. No-op if the counter is unknown.- Parameters:
key- statistics key- Returns:
- old value or, if the counter is unknown: 0
-
incrementCounter
Increment a counter. No-op if the counter is unknown. If the value is negative, it is ignored.- Parameters:
key- statistics keyvalue- value to increment- Returns:
- the updated value or, if the counter is unknown: 0
-
incrementGauge
Increment a gauge.No-op if the gauge is unknown.
- Parameters:
key- statistics keyvalue- value to increment- Returns:
- new value or 0 if the key is unknown
-
incrementMaximum
Increment a maximum.No-op if the maximum is unknown.
- Parameters:
key- statistics keyvalue- value to increment- Returns:
- new value or 0 if the key is unknown
-
incrementMinimum
Increment a minimum.No-op if the minimum is unknown.
- Parameters:
key- statistics keyvalue- value to increment- Returns:
- new value or 0 if the key is unknown
-
addMinimumSample
Add a minimum sample: if less than the current value, updates the value.No-op if the minimum is unknown.
- Parameters:
key- statistics keyvalue- sample value
-
addMaximumSample
Add a maximum sample: if greater than the current value, updates the value.No-op if the key is unknown.
- Parameters:
key- statistics keyvalue- sample value
-
addMeanStatisticSample
Add a sample to the mean statistics.No-op if the key is unknown.
- Parameters:
key- keyvalue- sample value.
-
reset
void reset()Reset all statistics. Unsynchronized. -
getCounterReference
Get a reference to the atomic instance providing the value for a specific counter. This is useful if the value is passed around.- Parameters:
key- statistic name- Returns:
- the reference
- Throws:
NullPointerException- if there is no entry of that name
-
getMaximumReference
Get a reference to the atomic instance providing the value for a specific maximum. This is useful if the value is passed around.- Parameters:
key- statistic name- Returns:
- the reference
- Throws:
NullPointerException- if there is no entry of that name
-
getMinimumReference
Get a reference to the atomic instance providing the value for a specific minimum. This is useful if the value is passed around.- Parameters:
key- statistic name- Returns:
- the reference
- Throws:
NullPointerException- if there is no entry of that name
-
getGaugeReference
Get a reference to the atomic instance providing the value for a specific gauge. This is useful if the value is passed around.- Parameters:
key- statistic name- Returns:
- the reference
- Throws:
NullPointerException- if there is no entry of that name
-
getMeanStatistic
Get a reference to the atomic instance providing the value for a specific meanStatistic. This is useful if the value is passed around.- Parameters:
key- statistic name- Returns:
- the reference
- Throws:
NullPointerException- if there is no entry of that name
-
addTimedOperation
Add a duration to the min/mean/max statistics, using the given prefix and adding a suffix for each specific value. The update is not-atomic, even though each individual statistic is updated thread-safely. If two threads update the values simultaneously, at the end of each operation the state will be correct. It is only during the sequence that the statistics may be observably inconsistent.- Parameters:
prefix- statistic prefixdurationMillis- duration in milliseconds.
-
addTimedOperation
Add a duration to the min/mean/max statistics, using the given prefix and adding a suffix for each specific value.; increment tha counter whose name == prefix. If any of the statistics are not registered, that part of the sequence will be omitted -the rest will proceed. The update is not-atomic, even though each individual statistic is updated thread-safely. If two threads update the values simultaneously, at the end of each operation the state will be correct. It is only during the sequence that the statistics may be observably inconsistent.- Parameters:
prefix- statistic prefixduration- duration
-
addSample
Add a statistics sample as a min, max and mean and count.- Parameters:
key- key to add.count- count.
-