@InterfaceAudience.Public @InterfaceStability.Unstable public final class WrappedStatistics extends Object
Serializable
arguments/return values are actually
IOStatisticsSource
instances; passing in the wrong value
will raise IllegalArgumentExceptions.Modifier and Type | Method and Description |
---|---|
static <T> T |
applyToIOStatisticsSnapshot(Serializable source,
org.apache.hadoop.util.functional.FunctionRaisingIOE<IOStatisticsSnapshot,T> fun)
Apply a function to an object which may be an IOStatisticsSnapshot.
|
static Map<String,Long> |
iostatistics_counters(Serializable source)
Get the counters of an IOStatisticsSnapshot.
|
static Map<String,Long> |
iostatistics_gauges(Serializable source)
Get the gauges of an IOStatisticsSnapshot.
|
static Map<String,Long> |
iostatistics_maximums(Serializable source)
Get the maximums of an IOStatisticsSnapshot.
|
static Map<String,Map.Entry<Long,Long>> |
iostatistics_means(Serializable source)
Get the means of an IOStatisticsSnapshot.
|
static Map<String,Long> |
iostatistics_minimums(Serializable source)
Get the minimums of an IOStatisticsSnapshot.
|
static String |
iostatistics_toPrettyString(Object statistics)
Convert IOStatistics to a string form, with all the metrics sorted
and empty value stripped.
|
static boolean |
iostatisticsContext_aggregate(Object source)
Aggregate into the IOStatistics context the statistics passed in via
IOStatistics/source parameter.
|
static boolean |
iostatisticsContext_enabled()
Static probe to check if the thread-level IO statistics enabled.
|
static Object |
iostatisticsContext_getCurrent()
Get the context's
IOStatisticsContext which
implements IOStatisticsSource . |
static void |
iostatisticsContext_reset()
Reset the context's IOStatistics.
|
static void |
iostatisticsContext_setThreadIOStatisticsContext(Object statisticsContext)
Set the IOStatisticsContext for the current thread.
|
static Serializable |
iostatisticsContext_snapshot()
Take a snapshot of the context IOStatistics.
|
static boolean |
iostatisticsSnapshot_aggregate(Serializable snapshot,
Object statistics)
Aggregate an existing
IOStatisticsSnapshot with
the supplied statistics. |
static Serializable |
iostatisticsSnapshot_create()
Create a new
IOStatisticsSnapshot instance. |
static Serializable |
iostatisticsSnapshot_create(Object source)
Create a new
IOStatisticsSnapshot instance. |
static Serializable |
iostatisticsSnapshot_fromJsonString(String json)
Load IOStatisticsSnapshot from a JSON string.
|
static Serializable |
iostatisticsSnapshot_load(FileSystem fs,
Path path)
Load IOStatisticsSnapshot from a Hadoop filesystem.
|
static Serializable |
iostatisticsSnapshot_retrieve(Object source)
Extract the IOStatistics from an object in a serializable form.
|
static void |
iostatisticsSnapshot_save(Serializable snapshot,
FileSystem fs,
Path path,
boolean overwrite)
Save IOStatisticsSnapshot to a Hadoop filesystem as a JSON file.
|
static String |
iostatisticsSnapshot_toJsonString(Serializable snapshot)
Save IOStatisticsSnapshot to a JSON string.
|
static boolean |
isIOStatistics(Object object)
Probe for an object being an instance of
IOStatistics . |
static boolean |
isIOStatisticsSnapshot(Serializable object)
Probe for an object being an instance of
IOStatisticsSnapshot . |
static boolean |
isIOStatisticsSource(Object object)
Probe for an object being an instance of
IOStatisticsSource . |
public static boolean isIOStatisticsSource(Object object)
IOStatisticsSource
.object
- object to probepublic static boolean isIOStatistics(Object object)
IOStatistics
.object
- object to probepublic static boolean isIOStatisticsSnapshot(Serializable object)
IOStatisticsSnapshot
.object
- object to probepublic static boolean iostatisticsSnapshot_aggregate(Serializable snapshot, @Nullable Object statistics)
IOStatisticsSnapshot
with
the supplied statistics.snapshot
- snapshot to updatestatistics
- IOStatistics to addIllegalArgumentException
- if the statistics
argument is not
null but not an instance of IOStatistics, or if snapshot
is invalid.public static Serializable iostatisticsSnapshot_create()
IOStatisticsSnapshot
instance.public static Serializable iostatisticsSnapshot_create(@Nullable Object source)
IOStatisticsSnapshot
instance.source
- optional source statisticsClassCastException
- if the source
is not null and not an IOStatistics instancepublic static Serializable iostatisticsSnapshot_load(FileSystem fs, Path path)
fs
- filesystempath
- pathUncheckedIOException
- Any IO exception.public static Serializable iostatisticsSnapshot_retrieve(@Nullable Object source)
source
- source object, may be null/not a statistics source/instanceIOStatisticsSnapshot
or null if the object is null/doesn't have statisticspublic static void iostatisticsSnapshot_save(@Nullable Serializable snapshot, FileSystem fs, Path path, boolean overwrite)
snapshot
- statisticsfs
- filesystempath
- pathoverwrite
- should any existing file be overwritten?UncheckedIOException
- Any IO exception.public static String iostatisticsSnapshot_toJsonString(@Nullable Serializable snapshot)
snapshot
- statistics; may be null or of an incompatible typeUncheckedIOException
- Any IO/jackson exception.IllegalArgumentException
- if the supplied class is not a snapshotpublic static Serializable iostatisticsSnapshot_fromJsonString(String json)
json
- JSON string value.UncheckedIOException
- Any IO/jackson exception.public static Map<String,Long> iostatistics_counters(Serializable source)
source
- source of statistics.public static Map<String,Long> iostatistics_gauges(Serializable source)
source
- source of statistics.public static Map<String,Long> iostatistics_minimums(Serializable source)
source
- source of statistics.public static Map<String,Long> iostatistics_maximums(Serializable source)
source
- source of statistics.public static Map<String,Map.Entry<Long,Long>> iostatistics_means(Serializable source)
source
- source of statistics.public static Object iostatisticsContext_getCurrent()
IOStatisticsContext
which
implements IOStatisticsSource
.
This is either a thread-local value or a global empty context.IOStatisticsContext
.public static void iostatisticsContext_setThreadIOStatisticsContext(@Nullable Object statisticsContext)
statisticsContext
- IOStatistics context instance for the
current thread. If null, the context is reset.public static boolean iostatisticsContext_enabled()
public static void iostatisticsContext_reset()
IOStatisticsContext.reset()
public static Serializable iostatisticsContext_snapshot()
IOStatisticsContext.snapshot()
IOStatisticsSnapshot
.public static boolean iostatisticsContext_aggregate(Object source)
Returns false if the source is null or does not contain any statistics.
source
- implementation of IOStatisticsSource
or IOStatistics
public static String iostatistics_toPrettyString(@Nullable Object statistics)
statistics
- A statistics instance; may be nullpublic static <T> T applyToIOStatisticsSnapshot(Serializable source, org.apache.hadoop.util.functional.FunctionRaisingIOE<IOStatisticsSnapshot,T> fun)
T
- return typesource
- statistics snapshotfun
- function to invoke if source
is valid.UncheckedIOException
- Any IO exception.IllegalArgumentException
- if the supplied class is not a snapshotCopyright © 2024 Apache Software Foundation. All rights reserved.