jinglining commented on a change in pull request #10359: [FLINK-14813][metrics] 
Provide `isBackPressured` Task metric
URL: https://github.com/apache/flink/pull/10359#discussion_r353079869
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/Task.java
 ##########
 @@ -351,6 +353,7 @@ public Task(
                this.taskManagerConfig = 
Preconditions.checkNotNull(taskManagerConfig);
 
                this.metrics = metricGroup;
+               metricGroup.gauge(MetricNames.IS_BACKPRESSURED, new 
BackPressureGauge(this));
 
 Review comment:
   > If you're going for a Gauge, why not just 
`metricGroup.gauge(MetricNames.IS_BACKPRESSURED, this::isBackPressured);`?
   > 
   > Also, since this effectively leaks a reference to an object under 
construction, have you verified that it is safe to call `isBackpressured` 
without the constructor having finished?
   
   Under what circumstances would call `isBackpressured` without the 
constructor having finished´╝č
   If has this circumstance, maybe register it in 
org.apache.flink.runtime.taskexecutor.TaskExecutor#submitTask will be better.

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


With regards,
Apache Git Services

Reply via email to