[
https://issues.apache.org/jira/browse/BEAM-11217?focusedWorklogId=676792&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-676792
]
ASF GitHub Bot logged work on BEAM-11217:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 04/Nov/21 23:24
Start Date: 04/Nov/21 23:24
Worklog Time Spent: 10m
Work Description: lostluck commented on a change in pull request #15887:
URL: https://github.com/apache/beam/pull/15887#discussion_r743269280
##########
File path: sdks/go/pkg/beam/core/runtime/metricsx/metricsx.go
##########
@@ -78,17 +78,54 @@ func groupByType(minfos []*pipepb.MonitoringInfo) (
continue
}
gauges[key] = value
- case
- UrnToString(UrnStartBundle),
- UrnToString(UrnProcessBundle),
- UrnToString(UrnFinishBundle),
- UrnToString(UrnTransformTotalTime):
+ case UrnToString(UrnStartBundle):
value, err := extractMsecValue(r)
if err != nil {
log.Println(err)
continue
}
- msecs[key] = value
+ if v, ok := msecs[key]; ok {
+ v.Start = value
+ msecs[key] = v
+ } else {
+ msecs[key] = metrics.MsecValue{Start: value}
+ }
+ case UrnToString(UrnProcessBundle):
+ value, err := extractMsecValue(r)
+ if err != nil {
+ log.Println(err)
+ continue
+ }
+ if v, ok := msecs[key]; ok {
+ v.Process = value
+ msecs[key] = v
+ } else {
+ msecs[key] = metrics.MsecValue{Process: value}
+ }
+ case UrnToString(UrnFinishBundle):
+ value, err := extractMsecValue(r)
+ if err != nil {
+ log.Println(err)
+ continue
+ }
+ if v, ok := msecs[key]; ok {
+ v.Finish = value
+ msecs[key] = v
+ } else {
+ msecs[key] = metrics.MsecValue{Finish: value}
+ }
+ case UrnToString(UrnTransformTotalTime):
+ value, err := extractMsecValue(r)
+ if err != nil {
+ log.Println(err)
+ continue
+ }
+ if v, ok := msecs[key]; ok {
+ v.Total = value
+ msecs[key] = v
+ } else {
+ msecs[key] = metrics.MsecValue{Total: value}
+ }
Review comment:
Instead of duplicating the code out, consider instead adding a single
inner switch statement to get to the right field to set or re-set. There's no
need for all this boilerplate repetition.
eg.
1. get or create value. (note, that map values, if they aren't in a map, are
already a 0 value.
2. Switch statement to update the field appropriately.
3. set the entry in the map to the updated value.
//
--
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]
Issue Time Tracking
-------------------
Worklog Id: (was: 676792)
Time Spent: 11h 40m (was: 11.5h)
> Implement metrics filtering
> ---------------------------
>
> Key: BEAM-11217
> URL: https://issues.apache.org/jira/browse/BEAM-11217
> Project: Beam
> Issue Type: Sub-task
> Components: sdk-go
> Reporter: Kamil Wasilewski
> Assignee: Ritesh Ghorse
> Priority: P3
> Labels: stale-assigned
> Time Spent: 11h 40m
> Remaining Estimate: 0h
>
> `metrics.Results` misses a method for querying metrics using a provided
> filter. The method should take a filter object as an argument and return
> `metrics.QueryResults` object containing metrics that matched the filter.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)