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

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

                Author: ASF GitHub Bot
            Created on: 09/Aug/21 15:00
            Start Date: 09/Aug/21 15:00
    Worklog Time Spent: 10m 
      Work Description: lostluck commented on a change in pull request #15289:
URL: https://github.com/apache/beam/pull/15289#discussion_r685272069



##########
File path: sdks/go/pkg/beam/core/runtime/harness/monitoring.go
##########
@@ -163,38 +162,65 @@ func monitoring(p *exec.Plan) ([]*pipepb.MonitoringInfo, 
map[string][]byte) {
        }.ExtractFrom(store)
 
        // Get the execution monitoring information from the bundle plan.
-       if snapshot, ok := p.Progress(); ok {
-               payload, err := metricsx.Int64Counter(snapshot.Count)
+
+       snapshot, ok := p.Progress()
+       if !ok {
+               return monitoringInfo, payloads
+       }
+       for _, pcol := range snapshot.PCols {
+               payload, err := metricsx.Int64Counter(pcol.ElementCount)
                if err != nil {
                        panic(err)
                }
 
                // TODO(BEAM-9934): This metric should account for elements in 
multiple windows.
-               payloads[getShortID(metrics.PCollectionLabels(snapshot.PID), 
metricsx.UrnElementCount)] = payload
+               payloads[getShortID(metrics.PCollectionLabels(pcol.ID), 
metricsx.UrnElementCount)] = payload
+
                monitoringInfo = append(monitoringInfo,
                        &pipepb.MonitoringInfo{
                                Urn:  
metricsx.UrnToString(metricsx.UrnElementCount),
                                Type: 
metricsx.UrnToType(metricsx.UrnElementCount),
                                Labels: map[string]string{
-                                       "PCOLLECTION": snapshot.PID,
+                                       "PCOLLECTION": pcol.ID,
                                },
                                Payload: payload,
                        })
 
-               payloads[getShortID(metrics.PTransformLabels(snapshot.ID), 
metricsx.UrnDataChannelReadIndex)] = payload
-               monitoringInfo = append(monitoringInfo,
-                       &pipepb.MonitoringInfo{
-                               Urn:  
metricsx.UrnToString(metricsx.UrnDataChannelReadIndex),
-                               Type: 
metricsx.UrnToType(metricsx.UrnDataChannelReadIndex),
-                               Labels: map[string]string{
-                                       "PTRANSFORM": snapshot.ID,
-                               },
-                               Payload: payload,
-                       })
+               // Skip pcollections without size
+               if pcol.SizeCount != 0 {
+                       payload, err := 
metricsx.Int64Distribution(pcol.SizeCount, pcol.SizeSum, pcol.SizeMin, 
pcol.SizeMax)
+                       if err != nil {
+                               panic(err)
+                       }
+                       monitoringInfo = append(monitoringInfo,
+                               &pipepb.MonitoringInfo{
+                                       Urn:  
"beam:metric:sampled_byte_size:v1",
+                                       Type: 
"beam:metrics:distribution_int_64",
+                                       Labels: map[string]string{
+                                               "PCOLLECTION": pcol.ID,

Review comment:
       That's what those IDs are. (They're taken from the bundle graph and 
populated in 
[exec/translate.go](https://github.com/apache/beam/pull/15289/files/b3d4d1a90d0ccc36150a7ef50d497a0e793a3d9d#diff-5f1959624a48fea7877e2dd71f648ea3fe8029b75a84c0ac6f5220888176464aR315)
 )
   
   Good to validate beyond "it works on Dataflow" :)




-- 
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: github-unsubscr...@beam.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

    Worklog Id:     (was: 635899)
    Time Spent: 2h 50m  (was: 2h 40m)

> "elements added" for input and output collections is always empty
> -----------------------------------------------------------------
>
>                 Key: BEAM-6374
>                 URL: https://issues.apache.org/jira/browse/BEAM-6374
>             Project: Beam
>          Issue Type: Bug
>          Components: runner-dataflow, sdk-go
>            Reporter: Andrew Brampton
>            Priority: P3
>          Time Spent: 2h 50m
>  Remaining Estimate: 0h
>
> The field for "Elements added" and "Estimated size" is always blank when 
> running a Go binary on Dataflow. For example when running the work count 
> example: https://pasteboard.co/HVf80BU.png



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to