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

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

                Author: ASF GitHub Bot
            Created on: 26/Dec/18 17:31
            Start Date: 26/Dec/18 17:31
    Worklog Time Spent: 10m 
      Work Description: ryan-williams commented on pull request #7272: 
[BEAM-6161] Introduce PCollectionConsumerRegistry and add ElementCoun…
URL: https://github.com/apache/beam/pull/7272#discussion_r244019202
 
 

 ##########
 File path: 
runners/core-java/src/main/java/org/apache/beam/runners/core/metrics/MetricsContainerImpl.java
 ##########
 @@ -142,13 +145,25 @@ public MetricUpdates getUpdates() {
   public Iterable<MonitoringInfo> getMonitoringInfos() {
     // Extract user metrics and store as MonitoringInfos.
     ArrayList<MonitoringInfo> monitoringInfos = new 
ArrayList<MonitoringInfo>();
-    MetricUpdates mus = this.getUpdates();
+    MetricUpdates metricUpdates = this.getUpdates();
 
-    for (MetricUpdate<Long> mu : mus.counterUpdates()) {
+    for (MetricUpdate<Long> metricUpdate : metricUpdates.counterUpdates()) {
       SimpleMonitoringInfoBuilder builder = new 
SimpleMonitoringInfoBuilder(true);
-      builder.setUrnForUserMetric(
-          mu.getKey().metricName().getNamespace(), 
mu.getKey().metricName().getName());
-      builder.setInt64Value(mu.getUpdate());
+      MetricName metricName = metricUpdate.getKey().metricName();
+      if (metricName instanceof MonitoringInfoMetricName) {
+        MonitoringInfoMetricName monitoringInfoName = 
(MonitoringInfoMetricName) metricName;
+        // Represents a specific MonitoringInfo for a specific URN.
+        builder.setUrn(monitoringInfoName.getUrn());
+        for (Entry<String, String> e : 
monitoringInfoName.getLabels().entrySet()) {
+          builder.setLabel(e.getKey(), e.getValue());
 
 Review comment:
   would `addLabel` be a better name for this function?
 
----------------------------------------------------------------
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: 178726)
    Time Spent: 4h 10m  (was: 4h)

> Add ElementCount MonitoringInfos for the Java SDK
> -------------------------------------------------
>
>                 Key: BEAM-6161
>                 URL: https://issues.apache.org/jira/browse/BEAM-6161
>             Project: Beam
>          Issue Type: New Feature
>          Components: java-fn-execution, sdk-java-harness
>            Reporter: Alex Amato
>            Assignee: Alex Amato
>            Priority: Major
>          Time Spent: 4h 10m
>  Remaining Estimate: 0h
>




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

Reply via email to