[ 
https://issues.apache.org/jira/browse/BEAM-4374?focusedWorklogId=234866&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-234866
 ]

ASF GitHub Bot logged work on BEAM-4374:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 29/Apr/19 20:09
            Start Date: 29/Apr/19 20:09
    Worklog Time Spent: 10m 
      Work Description: ajamato commented on pull request #8062: [BEAM-4374] 
Emit SampledByteCount distribution tuple system metric from Python SDK 
(@Ardagan helped contribute)
URL: https://github.com/apache/beam/pull/8062#discussion_r278360590
 
 

 ##########
 File path: sdks/python/apache_beam/runners/portability/fn_api_runner_test.py
 ##########
 @@ -611,35 +691,99 @@ def process(self, element):
 
     result_metrics = res.monitoring_metrics()
 
-    def assert_contains_metric(src, urn, pcollection, value):
-      for item in src:
-        if item.urn == urn:
-          if item.labels['PCOLLECTION'] == pcollection:
-            self.assertEqual(item.metric.counter_data.int64_value, value,
-                             str(("Metric has incorrect value", value, item)))
-            return
-      self.fail(str(("Metric not found", urn, pcollection, src)))
-
     counters = result_metrics.monitoring_infos()
+    # All element count and byte count metrics must have a PCOLLECTION_LABEL.
     self.assertFalse([x for x in counters if
-                      x.urn == monitoring_infos.ELEMENT_COUNT_URN
+                      x.urn in [monitoring_infos.ELEMENT_COUNT_URN,
+                                monitoring_infos.SAMPLED_BYTE_SIZE_URN]
                       and
                       monitoring_infos.PCOLLECTION_LABEL not in x.labels])
+    try:
+      labels = {'PCOLLECTION' : 'Impulse'}
+      self.assert_has_counter(
+          counters, monitoring_infos.ELEMENT_COUNT_URN, labels, 1)
 
-    assert_contains_metric(counters, monitoring_infos.ELEMENT_COUNT_URN,
-                           'Impulse', 1)
-    assert_contains_metric(counters, monitoring_infos.ELEMENT_COUNT_URN,
-                           'ref_PCollection_PCollection_1', 2)
-
-    # Skipping other pcollections due to non-deterministic naming for multiple
-    # outputs.
-
-    assert_contains_metric(counters, monitoring_infos.ELEMENT_COUNT_URN,
-                           'ref_PCollection_PCollection_5', 8)
-    assert_contains_metric(counters, monitoring_infos.ELEMENT_COUNT_URN,
-                           'ref_PCollection_PCollection_6', 8)
-    assert_contains_metric(counters, monitoring_infos.ELEMENT_COUNT_URN,
-                           'ref_PCollection_PCollection_7', 2)
+      # Create/Read, "out" output.
+      labels = {'PCOLLECTION' : 'ref_PCollection_PCollection_1'}
 
 Review comment:
   done
 
----------------------------------------------------------------
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:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 234866)
    Time Spent: 15h 40m  (was: 15.5h)

> Update existing metrics in the FN API to use new Metric Schema
> --------------------------------------------------------------
>
>                 Key: BEAM-4374
>                 URL: https://issues.apache.org/jira/browse/BEAM-4374
>             Project: Beam
>          Issue Type: New Feature
>          Components: beam-model
>            Reporter: Alex Amato
>            Priority: Major
>          Time Spent: 15h 40m
>  Remaining Estimate: 0h
>
> Update existing metrics to use the new proto and cataloging schema defined in:
> [_https://s.apache.org/beam-fn-api-metrics_]
>  * Check in new protos
>  * Define catalog file for metrics
>  * Port existing metrics to use this new format, based on catalog 
> names+metadata



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to