scwhittle commented on code in PR #34275:
URL: https://github.com/apache/beam/pull/34275#discussion_r1993076160


##########
runners/core-java/src/main/java/org/apache/beam/runners/core/metrics/MetricsContainerImpl.java:
##########
@@ -312,6 +313,12 @@ public MetricUpdates getUpdates() {
         return null;
       }
 
+      // Pass metric labels to MonitorintInfo
+      for (Map.Entry<String, String> entry : 
metricKey.metricName().getLabels().entrySet()) {
+        LOG.info("string key {} value {}", entry.getKey(), entry.getValue());
+        builder.setLabel(entry.getKey(), entry.getValue());

Review Comment:
   can use setLabels builder method and just pass in the map



##########
runners/core-java/src/main/java/org/apache/beam/runners/core/metrics/MetricsContainerImpl.java:
##########
@@ -312,6 +313,12 @@ public MetricUpdates getUpdates() {
         return null;
       }
 
+      // Pass metric labels to MonitorintInfo
+      for (Map.Entry<String, String> entry : 
metricKey.metricName().getLabels().entrySet()) {
+        LOG.info("string key {} value {}", entry.getKey(), entry.getValue());

Review Comment:
   rm log



##########
sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/ReadFromKafkaDoFn.java:
##########
@@ -250,6 +250,7 @@ private static final class SharedStateHolder {
 
   private transient @Nullable LoadingCache<KafkaSourceDescriptor, 
AverageRecordSize>
       avgRecordSizeCache;
+  private @Nullable KafkaMetrics kafkaResults;

Review Comment:
   instead of using a member variable how about passing this as a parameter to 
poll?  Then it can just be on the stack in processElement and doesn't need to 
be marked Nullable so it would remove some checks.



##########
runners/core-java/src/main/java/org/apache/beam/runners/core/metrics/MetricsContainerImpl.java:
##########
@@ -312,6 +313,12 @@ public MetricUpdates getUpdates() {
         return null;
       }
 
+      // Pass metric labels to MonitorintInfo

Review Comment:
   it seems like this is already done on line 330



-- 
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: github-unsubscr...@beam.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to