liferoad commented on code in PR #36334:
URL: https://github.com/apache/beam/pull/36334#discussion_r2395190714
##########
website/www/site/content/en/documentation/programming-guide.md:
##########
@@ -6327,19 +6327,16 @@ class MyMetricsDoFn(beam.DoFn):
self.counter = metrics.Metrics.counter("namespace", "counter1")
def process(self, element):
- counter.inc()
+ self.counter.inc()
yield element
-pipeline = beam.Pipeline()
-
-pipeline | beam.ParDo(MyMetricsDoFn())
-
-result = pipeline.run().wait_until_finish()
+with beam.Pipeline(runner=BundleBasedDirectRunner()) as p:
+ p | beam.Create([1, 2, 3]) | beam.ParDo(MyMetricsDoFn())
-metrics = result.metrics().query(
- metrics.MetricsFilter.with_namespace("namespace").with_name("counter1"))
+metrics_ = p.result.metrics().query(
Review Comment:
better name for metrics_?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]