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

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

                Author: ASF GitHub Bot
            Created on: 10/Jan/19 00:27
            Start Date: 10/Jan/19 00:27
    Worklog Time Spent: 10m 
      Work Description: ajamato commented on pull request #7323: [BEAM-6181] 
Implemented msec counters support in FnApi world.
URL: https://github.com/apache/beam/pull/7323#discussion_r246599649
 
 

 ##########
 File path: 
runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/WorkItemStatusClient.java
 ##########
 @@ -266,27 +267,42 @@ private synchronized WorkItemStatus 
createStatusUpdate(boolean isFinal) {
     return status;
   }
 
-  // todo(migryz) this method should return List<CounterUpdate> instead of 
updating member variable
   @VisibleForTesting
   synchronized void populateCounterUpdates(WorkItemStatus status) {
     if (worker == null) {
       return;
     }
 
+    // Checking against boolean, because getCompleted can return null
     boolean isFinalUpdate = Boolean.TRUE.equals(status.getCompleted());
 
-    ImmutableList.Builder<CounterUpdate> counterUpdatesListBuilder = 
ImmutableList.builder();
+    Map<Object, CounterUpdate> counterUpdatesMap = new HashMap<>();
+
+    final Consumer<CounterUpdate> appendCounterUpdate =
+        x ->
+            counterUpdatesMap.put(
+                x.getStructuredNameAndMetadata() == null
+                    ? x.getNameAndKind()
+                    : x.getStructuredNameAndMetadata(),
+                x);
+
     // Output counters
-    
counterUpdatesListBuilder.addAll(extractCounters(worker.getOutputCounters()));
+    extractCounters(worker.getOutputCounters()).forEach(appendCounterUpdate);
+
     // User metrics reported in Worker
-    counterUpdatesListBuilder.addAll(extractMetrics(isFinalUpdate));
+    extractMetrics(isFinalUpdate).forEach(appendCounterUpdate);
+
+    // counterUpdatesListBuilder.addAll(extractMetrics(isFinalUpdate));
 
 Review comment:
   Please delete commented out code before checking in
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


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

    Worklog Id:     (was: 183427)
    Time Spent: 11.5h  (was: 11h 20m)

> Utilize MetricInfo for reporting user metrics in Portable Dataflow Java 
> Runner.
> -------------------------------------------------------------------------------
>
>                 Key: BEAM-6181
>                 URL: https://issues.apache.org/jira/browse/BEAM-6181
>             Project: Beam
>          Issue Type: Bug
>          Components: java-fn-execution
>            Reporter: Mikhail Gryzykhin
>            Assignee: Mikhail Gryzykhin
>            Priority: Major
>          Time Spent: 11.5h
>  Remaining Estimate: 0h
>
> New approach to report metrics in FnApi is to utilize MetricInfo structures.
> This approach is implemented in Python SDK and work is ongoing in Java SDK.
> This tasks includes plumbing User metrics reported via MetricInfos through 
> Dataflow Java Runner. 



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

Reply via email to