Package org.apache.beam.sdk.metrics
Class MetricResult<T>
- java.lang.Object
-
- org.apache.beam.sdk.metrics.MetricResult<T>
-
@Experimental(METRICS) public abstract class MetricResult<T> extends java.lang.Object
The results of a single current metric.TODO(BEAM-6265): Decouple wire formats from internal formats, remove usage of MetricName.
-
-
Constructor Summary
Constructors Constructor Description MetricResult()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method 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, @Nullable T committed, T attempted)
static <T> MetricResult<T>
create(MetricKey key, java.lang.Boolean isCommittedSupported, T value)
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 @Nullable 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)
-
-
-
Method Detail
-
getName
public MetricName getName()
Return the name of the metric.
-
getKey
public abstract MetricKey getKey()
-
getCommitted
public T getCommitted()
Return the value of this metric across all successfully completed parts of the pipeline.Not all runners will support committed metrics. If they are not supported, the runner will throw an
UnsupportedOperationException
.
-
hasCommitted
public boolean hasCommitted()
-
getCommittedOrNull
public abstract @Nullable T getCommittedOrNull()
Return the value of this metric across all attempts of executing all parts of the pipeline.
-
getAttempted
public abstract T getAttempted()
Return the value of this metric across all attempts of executing all parts of the pipeline.
-
transform
public <V> MetricResult<V> transform(java.util.function.Function<T,V> fn)
-
addAttempted
public MetricResult<T> addAttempted(T update, java.util.function.BiFunction<T,T,T> combine)
-
addCommitted
public MetricResult<T> addCommitted(T update, java.util.function.BiFunction<T,T,T> combine)
-
attempted
public static <T> MetricResult<T> attempted(MetricKey key, T attempted)
-
create
public static <T> MetricResult<T> create(MetricKey key, java.lang.Boolean isCommittedSupported, T value)
-
create
public static <T> MetricResult<T> create(MetricKey key, @Nullable T committed, T attempted)
-
-