@Experimental(value=METRICS) public abstract class MetricResult<T> extends java.lang.Object
TODO(BEAM-6265): Decouple wire formats from internal formats, remove usage of MetricName.
Constructor and Description |
---|
MetricResult() |
Modifier and Type | Method and Description |
---|---|
MetricResult<T> |
addAttempted(T update,
java.util.function.BiFunction<T,T,T> combine) |
MetricResult<T> |
addCommitted(T update,
java.util.function.BiFunction<T,T,T> combine) |
static <T> MetricResult<T> |
attempted(MetricKey key,
T attempted) |
static <T> MetricResult<T> |
create(MetricKey key,
java.lang.Boolean isCommittedSupported,
T value) |
static <T> MetricResult<T> |
create(MetricKey key,
T committed,
T attempted) |
abstract T |
getAttempted()
Return the value of this metric across all attempts of executing all parts of the pipeline.
|
T |
getCommitted()
Return the value of this metric across all successfully completed parts of the pipeline.
|
abstract T |
getCommittedOrNull()
Return the value of this metric across all attempts of executing all parts of the pipeline.
|
abstract MetricKey |
getKey() |
MetricName |
getName()
Return the name of the metric.
|
boolean |
hasCommitted() |
<V> MetricResult<V> |
transform(java.util.function.Function<T,V> fn) |
public MetricName getName()
public abstract MetricKey getKey()
public T getCommitted()
Not all runners will support committed metrics. If they are not supported, the runner will
throw an UnsupportedOperationException
.
public boolean hasCommitted()
public abstract T getCommittedOrNull()
public abstract T getAttempted()
public <V> MetricResult<V> transform(java.util.function.Function<T,V> fn)
public MetricResult<T> addAttempted(T update, java.util.function.BiFunction<T,T,T> combine)
public MetricResult<T> addCommitted(T update, java.util.function.BiFunction<T,T,T> combine)
public static <T> MetricResult<T> attempted(MetricKey key, T attempted)
public static <T> MetricResult<T> create(MetricKey key, java.lang.Boolean isCommittedSupported, T value)
public static <T> MetricResult<T> create(MetricKey key, T committed, T attempted)