public final class IOStatisticsBinding
extends java.lang.Object
| Modifier and Type | Field | Description |
|---|---|---|
static java.lang.String |
ENTRY_PATTERN |
Pattern used for each entry.
|
static java.lang.String |
NULL_SOURCE |
String to return when a source is null.
|
| Modifier and Type | Method | Description |
|---|---|---|
static java.lang.Long |
aggregateCounters(java.lang.Long l,
java.lang.Long r) |
Aggregate two counters.
|
static java.lang.Long |
aggregateGauges(java.lang.Long l,
java.lang.Long r) |
Add two gauges.
|
static <E> void |
aggregateMaps(java.util.Map<java.lang.String,E> dest,
java.util.Map<java.lang.String,E> other,
java.util.function.BiFunction<E,E,E> aggregateFn,
java.util.function.Function<E,E> copyFn) |
Aggregate two maps so that the destination.
|
static java.lang.Long |
aggregateMaximums(java.lang.Long l,
java.lang.Long r) |
Aggregate two maximum values.
|
static MeanStatistic |
aggregateMeanStatistics(MeanStatistic l,
MeanStatistic r) |
Aggregate the mean statistics.
|
static java.lang.Long |
aggregateMinimums(java.lang.Long l,
java.lang.Long r) |
Aggregate two minimum values.
|
static DurationTracker |
createTracker(DurationTrackerFactory factory,
java.lang.String statistic) |
Create the tracker.
|
static DynamicIOStatisticsBuilder |
dynamicIOStatistics() |
Create a builder for dynamic IO Statistics.
|
static IOStatistics |
emptyStatistics() |
Get the shared instance of the immutable empty statistics
object.
|
static IOStatisticsStore |
emptyStatisticsStore() |
Get the shared instance of the immutable empty statistics
store.
|
static <E> java.lang.String |
entryToString(java.lang.String name,
E value) |
Convert entry values to the string format used in logging.
|
static <E> java.lang.String |
entryToString(java.util.Map.Entry<java.lang.String,E> entry) |
Convert an entry to the string format used in logging.
|
static IOStatistics |
fromStorageStatistics(StorageStatistics storageStatistics) |
Create IOStatistics from a storage statistics instance.
|
static <B> B |
invokeTrackingDuration(DurationTracker tracker,
CallableRaisingIOE<B> input) |
Given an IOException raising callable/lambda expression,
execute it, updating the tracker on success/failure.
|
static IOStatisticsStoreBuilder |
iostatisticsStore() |
Create a builder for an
IOStatisticsStore. |
static void |
maybeUpdateMaximum(java.util.concurrent.atomic.AtomicLong dest,
long sample) |
Update a maximum value tracked in an atomic long.
|
static void |
maybeUpdateMinimum(java.util.concurrent.atomic.AtomicLong dest,
long sample) |
Update a maximum value tracked in an atomic long.
|
static java.time.Duration |
measureDurationOfInvocation(DurationTrackerFactory factory,
java.lang.String statistic,
InvocationRaisingIOE input) |
Given an IOException raising callable/lambda expression,
execute it and update the relevant statistic,
returning the measured duration.
|
static DurationTrackerFactory |
pairedTrackerFactory(DurationTrackerFactory first,
DurationTrackerFactory second) |
Create a DurationTrackerFactory which aggregates the tracking
of two other factories.
|
static <E extends java.io.Serializable> |
passthroughFn(E src) |
A passthrough copy operation suitable for immutable
types, including numbers.
|
static StorageStatistics |
publishAsStorageStatistics(java.lang.String name,
java.lang.String scheme,
IOStatistics source) |
Publish the IOStatistics as a set of storage statistics.
|
static <E extends java.io.Serializable> |
snapshotMap(java.util.Map<java.lang.String,E> source) |
Take a snapshot of a supplied map, where the copy option simply
uses the existing value.
|
static <E extends java.io.Serializable> |
snapshotMap(java.util.Map<java.lang.String,E> source,
java.util.function.Function<E,E> copyFn) |
Take a snapshot of a supplied map, using the copy function
to replicate the source values.
|
static <B> B |
trackDuration(DurationTrackerFactory factory,
java.lang.String statistic,
CallableRaisingIOE<B> input) |
Given an IOException raising callable/lambda expression,
execute it and update the relevant statistic.
|
static <B> ConsumerRaisingIOE<B> |
trackDurationConsumer(DurationTrackerFactory factory,
java.lang.String statistic,
ConsumerRaisingIOE<B> input) |
Given an IOException raising Consumer,
return a new one which wraps the inner and tracks
the duration of the operation, including whether
it passes/fails.
|
static <B> java.util.concurrent.Callable<B> |
trackDurationOfCallable(DurationTrackerFactory factory,
java.lang.String statistic,
java.util.concurrent.Callable<B> input) |
Given a callable/lambda expression,
return a new one which wraps the inner and tracks
the duration of the operation, including whether
it passes/fails.
|
static void |
trackDurationOfInvocation(DurationTrackerFactory factory,
java.lang.String statistic,
InvocationRaisingIOE input) |
Given an IOException raising callable/lambda expression,
execute it and update the relevant statistic.
|
static <B> CallableRaisingIOE<B> |
trackDurationOfOperation(DurationTrackerFactory factory,
java.lang.String statistic,
CallableRaisingIOE<B> input) |
Given an IOException raising callable/lambda expression,
return a new one which wraps the inner and tracks
the duration of the operation, including whether
it passes/fails.
|
static <B> B |
trackDurationOfSupplier(DurationTrackerFactory factory,
java.lang.String statistic,
java.util.function.Supplier<B> input) |
Given a Java supplier, evaluate it while
tracking the duration of the operation and success/failure.
|
static <A,B> |
trackFunctionDuration(DurationTrackerFactory factory,
java.lang.String statistic,
FunctionRaisingIOE<A,B> inputFn) |
Given an IOException raising function/lambda expression,
return a new one which wraps the inner and tracks
the duration of the operation, including whether
it passes/fails.
|
static <A,B> |
trackJavaFunctionDuration(DurationTrackerFactory factory,
java.lang.String statistic,
java.util.function.Function<A,B> inputFn) |
Given a java function/lambda expression,
return a new one which wraps the inner and tracks
the duration of the operation, including whether
it passes/fails.
|
static IOStatisticsSource |
wrap(IOStatistics statistics) |
Take an IOStatistics instance and wrap it in a source.
|
public static final java.lang.String ENTRY_PATTERN
@VisibleForTesting public static final java.lang.String NULL_SOURCE
public static IOStatistics fromStorageStatistics(StorageStatistics storageStatistics)
storageStatistics - source data.public static DynamicIOStatisticsBuilder dynamicIOStatistics()
public static IOStatistics emptyStatistics()
public static IOStatisticsStore emptyStatisticsStore()
public static IOStatisticsSource wrap(IOStatistics statistics)
statistics - statistics.public static IOStatisticsStoreBuilder iostatisticsStore()
IOStatisticsStore.public static <E> java.lang.String entryToString(java.util.Map.Entry<java.lang.String,E> entry)
E - entry typeentry - entry to evaluatepublic static <E> java.lang.String entryToString(java.lang.String name,
E value)
E - type of values.name - statistic namevalue - stat valuepublic static <E extends java.io.Serializable> E passthroughFn(E src)
E - type of values.src - source objectpublic static <E extends java.io.Serializable> java.util.Map<java.lang.String,E> snapshotMap(java.util.Map<java.lang.String,E> source)
E - type of values.source - source mappublic static <E extends java.io.Serializable> java.util.concurrent.ConcurrentHashMap<java.lang.String,E> snapshotMap(java.util.Map<java.lang.String,E> source,
java.util.function.Function<E,E> copyFn)
E - type of values.source - source mapcopyFn - function to copy the valuepublic static <E> void aggregateMaps(java.util.Map<java.lang.String,E> dest,
java.util.Map<java.lang.String,E> other,
java.util.function.BiFunction<E,E,E> aggregateFn,
java.util.function.Function<E,E> copyFn)
E - type of valuesdest - destination map.other - other mapaggregateFn - function to aggregate the values.copyFn - function to copy the valuepublic static java.lang.Long aggregateCounters(java.lang.Long l,
java.lang.Long r)
l - left valuer - right valuepublic static java.lang.Long aggregateGauges(java.lang.Long l,
java.lang.Long r)
l - left valuer - right valuepublic static java.lang.Long aggregateMinimums(java.lang.Long l,
java.lang.Long r)
l - leftr - rightpublic static java.lang.Long aggregateMaximums(java.lang.Long l,
java.lang.Long r)
l - leftr - rightpublic static MeanStatistic aggregateMeanStatistics(MeanStatistic l, MeanStatistic r)
l - left valuer - right valuepublic static void maybeUpdateMaximum(java.util.concurrent.atomic.AtomicLong dest,
long sample)
dest - destination for all changes.sample - sample to update.public static void maybeUpdateMinimum(java.util.concurrent.atomic.AtomicLong dest,
long sample)
dest - destination for all changes.sample - sample to update.public static <A,B> FunctionRaisingIOE<A,B> trackFunctionDuration(@Nullable DurationTrackerFactory factory, java.lang.String statistic, FunctionRaisingIOE<A,B> inputFn)
A - type of argument to the input function.B - return type.factory - factory of duration trackersstatistic - statistic keyinputFn - input functionpublic static <A,B> java.util.function.Function<A,B> trackJavaFunctionDuration(@Nullable
DurationTrackerFactory factory,
java.lang.String statistic,
java.util.function.Function<A,B> inputFn)
A - type of argument to the input function.B - return type.factory - factory of duration trackersstatistic - statistic keyinputFn - input functionpublic static <B> B trackDuration(DurationTrackerFactory factory, java.lang.String statistic, CallableRaisingIOE<B> input) throws java.io.IOException
B - return type.factory - factory of duration trackersstatistic - statistic keyinput - input callable.java.io.IOException - raised on errors performing I/O.public static void trackDurationOfInvocation(DurationTrackerFactory factory, java.lang.String statistic, InvocationRaisingIOE input) throws java.io.IOException
factory - factory of duration trackersstatistic - statistic keyinput - input callable.java.io.IOException - IO failure.public static java.time.Duration measureDurationOfInvocation(DurationTrackerFactory factory, java.lang.String statistic, InvocationRaisingIOE input) throws java.io.IOException
trackDurationOfInvocation(DurationTrackerFactory, String, InvocationRaisingIOE)
with the duration returned for logging etc.; added as a new
method to avoid linking problems with any code calling the existing
method.factory - factory of duration trackersstatistic - statistic keyinput - input callable.java.io.IOException - IO failure.public static <B> CallableRaisingIOE<B> trackDurationOfOperation(@Nullable DurationTrackerFactory factory, java.lang.String statistic, CallableRaisingIOE<B> input)
B - return type.factory - factory of duration trackersstatistic - statistic keyinput - input callable.public static <B> B invokeTrackingDuration(DurationTracker tracker, CallableRaisingIOE<B> input) throws java.io.IOException
B - return type.tracker - duration tracker.input - input callable.java.io.IOException - on failure.public static <B> ConsumerRaisingIOE<B> trackDurationConsumer(@Nullable DurationTrackerFactory factory, java.lang.String statistic, ConsumerRaisingIOE<B> input)
B - return type.factory - factory of duration trackersstatistic - statistic keyinput - input callable.public static <B> java.util.concurrent.Callable<B> trackDurationOfCallable(@Nullable
DurationTrackerFactory factory,
java.lang.String statistic,
java.util.concurrent.Callable<B> input)
B - return type.factory - factory of duration trackersstatistic - statistic keyinput - input callable.public static <B> B trackDurationOfSupplier(@Nullable
DurationTrackerFactory factory,
java.lang.String statistic,
java.util.function.Supplier<B> input)
B - return type.factory - factory of duration trackersstatistic - statistic keyinput - input callable.public static DurationTracker createTracker(@Nullable DurationTrackerFactory factory, java.lang.String statistic)
factory - tracker factorystatistic - statistic to trackpublic static DurationTrackerFactory pairedTrackerFactory(DurationTrackerFactory first, DurationTrackerFactory second)
first - first tracker factorysecond - second tracker factorypublic static StorageStatistics publishAsStorageStatistics(java.lang.String name, java.lang.String scheme, IOStatistics source)
name - storage statistics name.scheme - FS scheme; may be null.source - IOStatistics source.Copyright © 2008–2025 Apache Software Foundation. All rights reserved.