Class DelegatingCounter

java.lang.Object
org.apache.beam.sdk.metrics.DelegatingCounter
All Implemented Interfaces:
Serializable, Counter, Metric

@Internal public class DelegatingCounter extends Object implements Metric, Counter, Serializable
Implementation of Counter that delegates to the instance for the current context.
See Also:
  • Constructor Details

    • DelegatingCounter

      public DelegatingCounter(MetricName name)
      Create a DelegatingCounter with perWorkerCounter and processWideContainer set to false.
      Parameters:
      name - Metric name for this metric.
    • DelegatingCounter

      public DelegatingCounter(MetricName name, boolean processWideContainer)
      Create a DelegatingCounter with perWorkerCounter set to false.
      Parameters:
      name - Metric name for this metric.
      processWideContainer - Whether this Counter is stored in the ProcessWide container or the current thread's container.
    • DelegatingCounter

      public DelegatingCounter(MetricName name, boolean processWideContainer, boolean perWorkerCounter)
      Parameters:
      name - Metric name for this metric.
      processWideContainer - Whether this Counter is stored in the ProcessWide container or the current thread's container.
      perWorkerCounter - Whether this Counter refers to a perWorker metric or not.
  • Method Details

    • inc

      public void inc()
      Increment the counter.
      Specified by:
      inc in interface Counter
    • inc

      public void inc(long n)
      Increment the counter by the given amount.
      Specified by:
      inc in interface Counter
    • dec

      public void dec()
      Specified by:
      dec in interface Counter
    • dec

      public void dec(long n)
      Specified by:
      dec in interface Counter
    • getName

      public MetricName getName()
      Description copied from interface: Metric
      The MetricName given to this metric.
      Specified by:
      getName in interface Metric