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

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

                Author: ASF GitHub Bot
            Created on: 11/Dec/18 17:41
            Start Date: 11/Dec/18 17:41
    Worklog Time Spent: 10m 
      Work Description: swegner commented on a change in pull request #6799: 
[BEAM-6138] Add User Counter Metric Support to Java SDK
URL: https://github.com/apache/beam/pull/6799#discussion_r240719532
 
 

 ##########
 File path: 
runners/core-java/src/main/java/org/apache/beam/runners/core/metrics/SimpleMonitoringInfoBuilder.java
 ##########
 @@ -0,0 +1,219 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.runners.core.metrics;
+
+import com.google.common.base.Splitter;
+import java.time.Instant;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import javax.annotation.Nullable;
+import org.apache.beam.model.fnexecution.v1.BeamFnApi;
+import org.apache.beam.model.fnexecution.v1.BeamFnApi.MonitoringInfo;
+import org.apache.beam.model.fnexecution.v1.BeamFnApi.MonitoringInfoSpec;
+import org.apache.beam.model.fnexecution.v1.BeamFnApi.MonitoringInfoSpecs;
+import org.apache.beam.model.fnexecution.v1.BeamFnApi.MonitoringInfoTypeUrns;
+import org.apache.beam.model.fnexecution.v1.BeamFnApi.MonitoringInfoUrns;
+import org.apache.beam.runners.core.construction.BeamUrns;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Simplified building of MonitoringInfo fields, allows setting one field at a 
time with simpler
+ * method calls, without needing to dive into the details of the nested protos.
+ *
+ * <p>There is no need to set the type field, by setting the appropriate value 
field: (i.e.
+ * setInt64Value), the typeUrn field is automatically set.
+ *
+ * <p>Additionally, if validateAndDropInvalid is set to true in the ctor, then 
MonitoringInfos will
+ * be returned as null when build() is called if any fields are not properly 
set. This is based on
+ * comparing the fields which are set to the MonitoringInfoSpec in 
beam_fn_api.proto.
+ *
+ * <p>Example Usage (ElementCount counter):
+ *
+ * <p>SimpleMonitoringInfoBuilder builder = new SimpleMonitoringInfoBuilder();
 
 Review comment:
   Our spotless config is 
[here](https://github.com/apache/beam/blob/3a348e8b6d400e61fd93c8eab3d80de1a1716fbf/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy#L672),
 which currently just used `googleJavaFormat()`. My preference would be to 
generally limit our customization and deviate only where it's important. GitHub 
isn't showing me the original diff so I can't tell exactly what's going wrong 
here.

----------------------------------------------------------------
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:
us...@infra.apache.org


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

    Worklog Id:     (was: 174174)
    Time Spent: 3.5h  (was: 3h 20m)

> 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
>          Time Spent: 3.5h
>  Remaining Estimate: 0h
>




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

Reply via email to