robertwb commented on a change in pull request #14805:
URL: https://github.com/apache/beam/pull/14805#discussion_r654701010



##########
File path: 
runners/core-java/src/main/java/org/apache/beam/runners/core/metrics/MetricsContainerImpl.java
##########
@@ -84,9 +86,22 @@
   private MetricsMap<KV<MetricName, HistogramData.BucketType>, HistogramCell> 
histograms =
       new MetricsMap<>(HistogramCell::new);
 
-  /** Create a new {@link MetricsContainerImpl} associated with the given 
{@code stepName}. */
+  /**
+   * Create a new {@link MetricsContainerImpl} associated with the given 
{@code stepName}. If
+   * stepName is null, this MetricsContainer is not bound to a step.
+   */
   public MetricsContainerImpl(@Nullable String stepName) {
     this.stepName = stepName;
+    this.isProcessWide = false;

Review comment:
       this(stepName, false)

##########
File path: 
sdks/java/harness/src/main/java/org/apache/beam/fn/harness/FnHarness.java
##########
@@ -262,6 +265,8 @@ public static void main(
                     }
                   });
 
+      MetricsEnvironment.setProcessWideContainer(new MetricsContainerImpl());

Review comment:
       Remind me why MetricsEnvironment needs a setter rather than it just 
implicitly always creating one. 

##########
File path: 
runners/core-java/src/main/java/org/apache/beam/runners/core/metrics/MetricsContainerImpl.java
##########
@@ -108,6 +126,11 @@ private void reset(MetricsMap<?, ? extends MetricCell<?>> 
cells) {
     }
   }
 
+  @Override
+  public boolean isProcessWide() {

Review comment:
       Is the only use of this to prevent it from being reset? (Which, 
presumably, would be easy to accidentally do?) If so, can we make this private 
(or just access the member directly) and remove the addition to the interface?

##########
File path: 
runners/core-java/src/main/java/org/apache/beam/runners/core/metrics/MetricsContainerImpl.java
##########
@@ -84,9 +86,22 @@
   private MetricsMap<KV<MetricName, HistogramData.BucketType>, HistogramCell> 
histograms =
       new MetricsMap<>(HistogramCell::new);
 
-  /** Create a new {@link MetricsContainerImpl} associated with the given 
{@code stepName}. */
+  /**
+   * Create a new {@link MetricsContainerImpl} associated with the given 
{@code stepName}. If
+   * stepName is null, this MetricsContainer is not bound to a step.

Review comment:
       Is not being bound to a step equivalent to being process wide? 




-- 
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]


Reply via email to