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

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

                Author: ASF GitHub Bot
            Created on: 30/Apr/19 17:59
            Start Date: 30/Apr/19 17:59
    Worklog Time Spent: 10m 
      Work Description: ajamato commented on pull request #8280: [BEAM-6138] 
Update java SDK to report user distribution tuple metrics over the FN API
URL: https://github.com/apache/beam/pull/8280#discussion_r279853639
 
 

 ##########
 File path: 
runners/core-java/src/main/java/org/apache/beam/runners/core/metrics/MetricsContainerImpl.java
 ##########
 @@ -187,6 +186,44 @@ private MonitoringInfo 
counterUpdateToMonitoringInfo(MetricUpdate<Long> metricUp
     return builder.build();
   }
 
+  /**
+   * @param metricUpdate
+   * @return The MonitoringInfo generated from the metricUpdate.
+   */
+  @Nullable
+  private MonitoringInfo distributionUpdateToMonitoringInfo(
+      MetricUpdate<org.apache.beam.runners.core.metrics.DistributionData> 
metricUpdate) {
+    SimpleMonitoringInfoBuilder builder = new 
SimpleMonitoringInfoBuilder(true);
+    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());
+      }
+    } else { // Note: (metricName instanceof MetricName) is always True.
+      // Represents a user counter.
+      builder
+          .setUrn(MonitoringInfoConstants.Urns.USER_DISTRIBUTION_COUNTER)
+          .setLabel(
+              MonitoringInfoConstants.Labels.NAMESPACE,
+              metricUpdate.getKey().metricName().getNamespace())
+          .setLabel(
+              MonitoringInfoConstants.Labels.NAME, 
metricUpdate.getKey().metricName().getName());
+
+      // Drop if the stepname is not set. All user counters must be
+      // defined for a PTransform. They must be defined on a container bound 
to a step.
+      if (this.stepName == null) { // TODO rethink this/rm this check.
+        return null;
 
 Review comment:
   added todo
 
----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


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

    Worklog Id:     (was: 235442)
    Time Spent: 11h  (was: 10h 50m)

> Add User Metric Support to Java SDK
> -----------------------------------
>
>                 Key: BEAM-6138
>                 URL: https://issues.apache.org/jira/browse/BEAM-6138
>             Project: Beam
>          Issue Type: New Feature
>          Components: java-fn-execution
>            Reporter: Alex Amato
>            Assignee: Alex Amato
>            Priority: Major
>              Labels: triaged
>          Time Spent: 11h
>  Remaining Estimate: 0h
>




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

Reply via email to