lostluck commented on a change in pull request #15923:
URL: https://github.com/apache/beam/pull/15923#discussion_r745972612



##########
File path: sdks/go/pkg/beam/core/runtime/metricsx/metricsx.go
##########
@@ -100,17 +112,38 @@ func groupByType(minfos []*pipepb.MonitoringInfo) (
                                v.Total = value
                        }
                        msecs[key] = v
+               case UrnToString(UrnElementCount):
+                       value, err := extractCounterValue(r)
+                       if err != nil {
+                               log.Println(err)
+                               continue
+                       }
+                       v := pcols[key]
+                       v.ElementCount = value
+                       pcols[key] = v
+               case UrnToString(UrnSampledByteSize):
+                       value, err := extractDistributionValue(r)
+                       if err != nil {
+                               log.Println(err)
+                               continue
+                       }
+                       v := pcols[key]
+                       v.SampledByteSize = value
+                       pcols[key] = v
                default:
                        log.Println("unknown metric type")
                }
        }
-       return counters, distributions, gauges, msecs
+       return counters, distributions, gauges, msecs, pcols
 }
 
-func extractKey(mi *pipepb.MonitoringInfo) (metrics.StepKey, error) {
+func extractKey(mi *pipepb.MonitoringInfo, p map[string]string) 
(metrics.StepKey, error) {
        labels := newLabels(mi.GetLabels())
        stepName := labels.Transform()
 
+       if v, ok := p[labels.PCollection()]; ok {

Review comment:
       Consider a longer name for the p parameter since the types don't 
indicate usage clearly. Go does prefer shorter names, but not at the loss of 
clarity.
   
   ```suggestion
   func extractKey(mi *pipepb.MonitoringInfo, colToTransform map[string]string) 
(metrics.StepKey, error) {
        labels := newLabels(mi.GetLabels())
        stepName := labels.Transform()
   
        if v, ok := colToTransform[labels.PCollection()]; ok {
   ```




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


Reply via email to