Class MetricResult<T>

java.lang.Object
org.apache.beam.sdk.metrics.MetricResult<T>

public abstract class MetricResult<T> extends Object
The results of a single current metric.

TODO(BEAM-6265): Decouple wire formats from internal formats, remove usage of MetricName.

  • Constructor Details

    • MetricResult

      public MetricResult()
  • Method Details

    • 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(Function<T,V> fn)
    • addAttempted

      public MetricResult<T> addAttempted(T update, BiFunction<T,T,T> combine)
    • addCommitted

      public MetricResult<T> addCommitted(T update, 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, Boolean isCommittedSupported, T value)
    • create

      public static <T> MetricResult<T> create(MetricKey key, @Nullable T committed, T attempted)