apache_beam.metrics.metricbase module

The classes in this file are interfaces for metrics. They are not intended to be subclassed or created directly by users. To work with and access metrics, users should use the classes and methods exposed in metric.py.

Available classes:

  • Metric - Base interface of a metrics object.
  • Counter - Counter metric interface. Allows a count to be incremented or
    decremented during pipeline execution.
  • Distribution - Distribution Metric interface. Allows statistics about the
    distribution of a variable to be collected during pipeline execution.
  • Gauge - Gauge Metric interface. Allows to track the latest value of a
    variable during pipeline execution.
  • MetricName - Namespace and name used to refer to a Metric.
class apache_beam.metrics.metricbase.MetricName(namespace, name, urn=None, labels=None)[source]

Bases: object

The name of a metric.

The name of a metric consists of a namespace and a name. The namespace allows grouping related metrics together and also prevents collisions between multiple metrics of the same name.

Initializes MetricName.

Note: namespace and name should be set for user metrics, urn and labels should be set for an arbitrary metric to package into a MonitoringInfo.

Parameters:
  • namespace – A string with the namespace of a metric.
  • name – A string with the name of a metric.
  • urn – URN to populate on a MonitoringInfo, when sending to RunnerHarness.
  • labels – Labels to populate on a MonitoringInfo
fast_name()[source]
class apache_beam.metrics.metricbase.Metric(metric_name)[source]

Bases: object

Base interface of a metric object.

class apache_beam.metrics.metricbase.Counter(metric_name)[source]

Bases: apache_beam.metrics.metricbase.Metric

Counter metric interface. Allows a count to be incremented/decremented during pipeline execution.

inc(n=1)[source]
dec(n=1)[source]
class apache_beam.metrics.metricbase.Distribution(metric_name)[source]

Bases: apache_beam.metrics.metricbase.Metric

Distribution Metric interface.

Allows statistics about the distribution of a variable to be collected during pipeline execution.

update(value)[source]
class apache_beam.metrics.metricbase.Gauge(metric_name)[source]

Bases: apache_beam.metrics.metricbase.Metric

Gauge Metric interface.

Allows tracking of the latest value of a variable during pipeline execution.

set(value)[source]
class apache_beam.metrics.metricbase.Histogram(metric_name)[source]

Bases: apache_beam.metrics.metricbase.Metric

Histogram Metric interface.

Allows statistics about the percentile of a variable to be collected during pipeline execution.

update(value)[source]