Class 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 Detail

      • MetricResult

        public MetricResult()
    • 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)
      • 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)