@InterfaceAudience.Public @InterfaceStability.Evolving public final class IOStatisticsSnapshot extends Object implements IOStatistics, Serializable, IOStatisticsAggregator, IOStatisticsSetters
It is serializable so that frameworks which can use java serialization
to propagate data (Spark, Flink...) can send the statistics
back. For this reason, TreeMaps are explicitly used as field types,
even though IDEs can recommend use of Map instead.
For security reasons, untrusted java object streams should never be
deserialized. If for some reason this is required, use
requiredSerializationClasses()
to get the list of classes
used when deserializing instances of this object.
It is annotated for correct serializations with jackson2.
MAX_UNSET_VALUE, MIN_UNSET_VALUE
Constructor and Description |
---|
IOStatisticsSnapshot()
Construct.
|
IOStatisticsSnapshot(IOStatistics source)
Construct, taking a snapshot of the source statistics data
if the source is non-null.
|
Modifier and Type | Method and Description |
---|---|
boolean |
aggregate(IOStatistics source)
Aggregate the current statistics with the
source reference passed in.
|
void |
clear()
Clear all the maps.
|
Map<String,Long> |
counters()
Map of counters.
|
Map<String,Long> |
gauges()
Map of gauges.
|
Map<String,Long> |
maximums()
Map of maximums.
|
Map<String,MeanStatistic> |
meanStatistics()
Map of meanStatistics.
|
Map<String,Long> |
minimums()
Map of minimums.
|
static List<Class> |
requiredSerializationClasses()
What classes are needed to deserialize this class?
Needed to securely unmarshall this from untrusted sources.
|
static org.apache.hadoop.util.JsonSerialization<IOStatisticsSnapshot> |
serializer()
Get a JSON serializer for this class.
|
void |
setCounter(String key,
long value)
Set a counter.
|
void |
setGauge(String key,
long value)
Set a gauge.
|
void |
setMaximum(String key,
long value)
Set a maximum.
|
void |
setMeanStatistic(String key,
MeanStatistic value)
Set a mean statistic to a given value.
|
void |
setMinimum(String key,
long value)
Set a minimum.
|
void |
snapshot(IOStatistics source)
Take a snapshot.
|
String |
toString() |
public IOStatisticsSnapshot()
public IOStatisticsSnapshot(IOStatistics source)
source
- statistics source. Nullable.public void clear()
public void snapshot(IOStatistics source)
source
- statistics source.public boolean aggregate(@Nullable IOStatistics source)
aggregate
in interface IOStatisticsAggregator
source
- source; may be nullpublic Map<String,Long> counters()
IOStatistics
counters
in interface IOStatistics
public Map<String,Long> gauges()
IOStatistics
gauges
in interface IOStatistics
public Map<String,Long> minimums()
IOStatistics
minimums
in interface IOStatistics
public Map<String,Long> maximums()
IOStatistics
maximums
in interface IOStatistics
public Map<String,MeanStatistic> meanStatistics()
IOStatistics
meanStatistics
in interface IOStatistics
public void setCounter(String key, long value)
IOStatisticsSetters
setCounter
in interface IOStatisticsSetters
key
- statistics keyvalue
- value to setpublic void setGauge(String key, long value)
IOStatisticsSetters
setGauge
in interface IOStatisticsSetters
key
- statistics keyvalue
- value to setpublic void setMaximum(String key, long value)
IOStatisticsSetters
setMaximum
in interface IOStatisticsSetters
key
- statistics keyvalue
- value to setpublic void setMinimum(String key, long value)
IOStatisticsSetters
setMinimum
in interface IOStatisticsSetters
key
- statistics keyvalue
- value to setpublic void setMeanStatistic(String key, MeanStatistic value)
IOStatisticsSetters
setMeanStatistic
in interface IOStatisticsSetters
key
- statistic keyvalue
- new value.public static org.apache.hadoop.util.JsonSerialization<IOStatisticsSnapshot> serializer()
Copyright © 2024 Apache Software Foundation. All rights reserved.