blob: 1e16ba4d026c48e3a650b9ab777c0f24a651041f [file] [log] [blame]
<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>apache_beam.metrics.metric module &mdash; Apache Beam documentation</title>
<script type="text/javascript" src="_static/js/modernizr.min.js"></script>
<script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/language_data.js"></script>
<script async="async" type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="_static/js/theme.js"></script>
<link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="apache_beam.metrics.metricbase module" href="apache_beam.metrics.metricbase.html" />
<link rel="prev" title="apache_beam.metrics.cells module" href="apache_beam.metrics.cells.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="index.html" class="icon icon-home"> Apache Beam
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="apache_beam.coders.html">apache_beam.coders package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.dataframe.html">apache_beam.dataframe package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.io.html">apache_beam.io package</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="apache_beam.metrics.html">apache_beam.metrics package</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="apache_beam.metrics.html#submodules">Submodules</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="apache_beam.metrics.cells.html">apache_beam.metrics.cells module</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#">apache_beam.metrics.metric module</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.metrics.metricbase.html">apache_beam.metrics.metricbase module</a></li>
<li class="toctree-l3"><a class="reference internal" href="apache_beam.metrics.monitoring_infos.html">apache_beam.metrics.monitoring_infos module</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.ml.html">apache_beam.ml package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.options.html">apache_beam.options package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.portability.html">apache_beam.portability package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.runners.html">apache_beam.runners package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.transforms.html">apache_beam.transforms package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.typehints.html">apache_beam.typehints package</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.utils.html">apache_beam.utils package</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.error.html">apache_beam.error module</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.pipeline.html">apache_beam.pipeline module</a></li>
<li class="toctree-l1"><a class="reference internal" href="apache_beam.pvalue.html">apache_beam.pvalue module</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="index.html">Apache Beam</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="index.html">Docs</a> &raquo;</li>
<li><a href="apache_beam.metrics.html">apache_beam.metrics package</a> &raquo;</li>
<li>apache_beam.metrics.metric module</li>
<li class="wy-breadcrumbs-aside">
<a href="_sources/apache_beam.metrics.metric.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="module-apache_beam.metrics.metric">
<span id="apache-beam-metrics-metric-module"></span><h1>apache_beam.metrics.metric module<a class="headerlink" href="#module-apache_beam.metrics.metric" title="Permalink to this headline"></a></h1>
<p>User-facing classes for Metrics API.</p>
<p>The classes in this file allow users to define and use metrics to be collected
and displayed as part of their pipeline execution.</p>
<ul class="simple">
<li><dl class="first docutils">
<dt>Metrics - This class lets pipeline and transform writers create and access</dt>
<dd>metric objects such as counters, distributions, etc.</dd>
</dl>
</li>
</ul>
<dl class="class">
<dt id="apache_beam.metrics.metric.Metrics">
<em class="property">class </em><code class="descclassname">apache_beam.metrics.metric.</code><code class="descname">Metrics</code><a class="reference internal" href="_modules/apache_beam/metrics/metric.html#Metrics"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.metrics.metric.Metrics" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<p>Lets users create/access metric objects during pipeline execution.</p>
<dl class="staticmethod">
<dt id="apache_beam.metrics.metric.Metrics.get_namespace">
<em class="property">static </em><code class="descname">get_namespace</code><span class="sig-paren">(</span><em>namespace</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/metrics/metric.html#Metrics.get_namespace"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.metrics.metric.Metrics.get_namespace" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="staticmethod">
<dt id="apache_beam.metrics.metric.Metrics.counter">
<em class="property">static </em><code class="descname">counter</code><span class="sig-paren">(</span><em>namespace</em>, <em>name</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/metrics/metric.html#Metrics.counter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.metrics.metric.Metrics.counter" title="Permalink to this definition"></a></dt>
<dd><p>Obtains or creates a Counter metric.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>namespace</strong> – A class or string that gives the namespace to a metric</li>
<li><strong>name</strong> – A string that gives a unique name to a metric</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A Counter object.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="staticmethod">
<dt id="apache_beam.metrics.metric.Metrics.distribution">
<em class="property">static </em><code class="descname">distribution</code><span class="sig-paren">(</span><em>namespace</em>, <em>name</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/metrics/metric.html#Metrics.distribution"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.metrics.metric.Metrics.distribution" title="Permalink to this definition"></a></dt>
<dd><p>Obtains or creates a Distribution metric.</p>
<p>Distribution metrics are restricted to integer-only distributions.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>namespace</strong> – A class or string that gives the namespace to a metric</li>
<li><strong>name</strong> – A string that gives a unique name to a metric</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A Distribution object.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="staticmethod">
<dt id="apache_beam.metrics.metric.Metrics.gauge">
<em class="property">static </em><code class="descname">gauge</code><span class="sig-paren">(</span><em>namespace</em>, <em>name</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/metrics/metric.html#Metrics.gauge"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.metrics.metric.Metrics.gauge" title="Permalink to this definition"></a></dt>
<dd><p>Obtains or creates a Gauge metric.</p>
<p>Gauge metrics are restricted to integer-only values.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>namespace</strong> – A class or string that gives the namespace to a metric</li>
<li><strong>name</strong> – A string that gives a unique name to a metric</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A Distribution object.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="class">
<dt id="apache_beam.metrics.metric.Metrics.DelegatingCounter">
<em class="property">class </em><code class="descname">DelegatingCounter</code><span class="sig-paren">(</span><em>metric_name</em>, <em>process_wide=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/metrics/metric.html#Metrics.DelegatingCounter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.metrics.metric.Metrics.DelegatingCounter" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="apache_beam.metrics.metricbase.html#apache_beam.metrics.metricbase.Counter" title="apache_beam.metrics.metricbase.Counter"><code class="xref py py-class docutils literal notranslate"><span class="pre">apache_beam.metrics.metricbase.Counter</span></code></a></p>
<p>Metrics Counter that Delegates functionality to MetricsEnvironment.</p>
</dd></dl>
<dl class="class">
<dt id="apache_beam.metrics.metric.Metrics.DelegatingDistribution">
<em class="property">class </em><code class="descname">DelegatingDistribution</code><span class="sig-paren">(</span><em>metric_name</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/metrics/metric.html#Metrics.DelegatingDistribution"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.metrics.metric.Metrics.DelegatingDistribution" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="apache_beam.metrics.metricbase.html#apache_beam.metrics.metricbase.Distribution" title="apache_beam.metrics.metricbase.Distribution"><code class="xref py py-class docutils literal notranslate"><span class="pre">apache_beam.metrics.metricbase.Distribution</span></code></a></p>
<p>Metrics Distribution Delegates functionality to MetricsEnvironment.</p>
</dd></dl>
<dl class="class">
<dt id="apache_beam.metrics.metric.Metrics.DelegatingGauge">
<em class="property">class </em><code class="descname">DelegatingGauge</code><span class="sig-paren">(</span><em>metric_name</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/metrics/metric.html#Metrics.DelegatingGauge"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.metrics.metric.Metrics.DelegatingGauge" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="apache_beam.metrics.metricbase.html#apache_beam.metrics.metricbase.Gauge" title="apache_beam.metrics.metricbase.Gauge"><code class="xref py py-class docutils literal notranslate"><span class="pre">apache_beam.metrics.metricbase.Gauge</span></code></a></p>
<p>Metrics Gauge that Delegates functionality to MetricsEnvironment.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="apache_beam.metrics.metric.MetricsFilter">
<em class="property">class </em><code class="descclassname">apache_beam.metrics.metric.</code><code class="descname">MetricsFilter</code><a class="reference internal" href="_modules/apache_beam/metrics/metric.html#MetricsFilter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.metrics.metric.MetricsFilter" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<p>Simple object to filter metrics results.</p>
<p>This class is experimental. No backwards-compatibility guarantees.</p>
<p>If filters by matching a result’s step-namespace-name with three internal
sets. No execution/matching logic is added to this object, so that it may
be used to construct arguments as an RPC request. It is left for runners
to implement matching logic by themselves.</p>
<p>Note: This class only supports user defined metrics.</p>
<dl class="attribute">
<dt id="apache_beam.metrics.metric.MetricsFilter.steps">
<code class="descname">steps</code><a class="headerlink" href="#apache_beam.metrics.metric.MetricsFilter.steps" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="apache_beam.metrics.metric.MetricsFilter.names">
<code class="descname">names</code><a class="headerlink" href="#apache_beam.metrics.metric.MetricsFilter.names" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="apache_beam.metrics.metric.MetricsFilter.namespaces">
<code class="descname">namespaces</code><a class="headerlink" href="#apache_beam.metrics.metric.MetricsFilter.namespaces" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="apache_beam.metrics.metric.MetricsFilter.with_metric">
<code class="descname">with_metric</code><span class="sig-paren">(</span><em>metric</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/metrics/metric.html#MetricsFilter.with_metric"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.metrics.metric.MetricsFilter.with_metric" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="apache_beam.metrics.metric.MetricsFilter.with_name">
<code class="descname">with_name</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/metrics/metric.html#MetricsFilter.with_name"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.metrics.metric.MetricsFilter.with_name" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="apache_beam.metrics.metric.MetricsFilter.with_names">
<code class="descname">with_names</code><span class="sig-paren">(</span><em>names</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/metrics/metric.html#MetricsFilter.with_names"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.metrics.metric.MetricsFilter.with_names" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="apache_beam.metrics.metric.MetricsFilter.with_namespace">
<code class="descname">with_namespace</code><span class="sig-paren">(</span><em>namespace</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/metrics/metric.html#MetricsFilter.with_namespace"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.metrics.metric.MetricsFilter.with_namespace" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="apache_beam.metrics.metric.MetricsFilter.with_namespaces">
<code class="descname">with_namespaces</code><span class="sig-paren">(</span><em>namespaces</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/metrics/metric.html#MetricsFilter.with_namespaces"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.metrics.metric.MetricsFilter.with_namespaces" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="apache_beam.metrics.metric.MetricsFilter.with_step">
<code class="descname">with_step</code><span class="sig-paren">(</span><em>step</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/metrics/metric.html#MetricsFilter.with_step"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.metrics.metric.MetricsFilter.with_step" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="apache_beam.metrics.metric.MetricsFilter.with_steps">
<code class="descname">with_steps</code><span class="sig-paren">(</span><em>steps</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/apache_beam/metrics/metric.html#MetricsFilter.with_steps"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#apache_beam.metrics.metric.MetricsFilter.with_steps" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="apache_beam.metrics.metricbase.html" class="btn btn-neutral float-right" title="apache_beam.metrics.metricbase module" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="apache_beam.metrics.cells.html" class="btn btn-neutral float-left" title="apache_beam.metrics.cells module" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>