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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]