pabloem commented on a change in pull request #12123:
URL: https://github.com/apache/beam/pull/12123#discussion_r448128821



##########
File path: sdks/python/apache_beam/metrics/metric_test.py
##########
@@ -159,15 +163,26 @@ def process(self, element):
     res = pipeline.run()
     res.wait_until_finish()
 
+    # Verify static counter.
+    metric_results = (
+        res.metrics().query(
+            MetricsFilter().with_metric(SomeDoFn.static_counter_elements)))
+    outputs_static_counter = metric_results['counters'][0]
+
+    self.assertEqual(
+        outputs_static_counter.key.metric.name,
+        'metrics_static_counter_element')
+    self.assertEqual(outputs_static_counter.committed, 8)
+
     # Verify user counter.
     metric_results = (
         res.metrics().query(
             MetricsFilter().with_name('metrics_user_counter_element')))
-    outputs_counter = metric_results['counters'][0]
+    outputs_user_counter = metric_results['counters'][0]

Review comment:
       you're right. I would not call this the canonical way. Though tbh this 
API should be improved to be less JAva-like. 
   
   In this case, we query it this way only for purposes of the unittest, 
because we know what to expect.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to