apache_beam.internal.metrics.metric module

Metrics API classes for internal use only.

Users should use apache_beam.metrics.metric package instead.

For internal use only. No backwards compatibility guarantees.

class apache_beam.internal.metrics.metric.Metrics[source]

Bases: object

static counter(urn, labels=None, process_wide=False)[source]

Obtains or creates a Counter metric.

Parameters:
  • namespace – A class or string that gives the namespace to a metric
  • name – A string that gives a unique name to a metric
  • urn – URN to populate on a MonitoringInfo, when sending to RunnerHarness.
  • labels – Labels to populate on a MonitoringInfo
  • process_wide – Whether or not the metric is specific to the current bundle or should be calculated for the entire process.
Returns:

A Counter object.

static histogram(namespace, name, bucket_type, logger=None)[source]

Obtains or creates a Histogram metric.

Parameters:
  • namespace – A class or string that gives the namespace to a metric
  • name – A string that gives a unique name to a metric
  • bucket_type – A type of bucket used in a histogram. A subclass of apache_beam.utils.histogram.BucketType
  • logger – MetricLogger for logging locally aggregated metric
Returns:

A Histogram object.

class DelegatingHistogram(metric_name, bucket_type, logger)[source]

Bases: apache_beam.metrics.metricbase.Histogram

Metrics Histogram that Delegates functionality to MetricsEnvironment.

update(value)[source]