zhijiangW commented on a change in pull request #8455: 
[FLINK-12284,FLINK-12637][Network,Metrics]Fix the incorrect inputBufferUsage 
metric in credit-based network mode
URL: https://github.com/apache/flink/pull/8455#discussion_r297494125
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/metrics/NettyShuffleMetricFactory.java
 ##########
 @@ -154,24 +157,40 @@ private static void registerOutputMetrics(
 
        public static void registerInputMetrics(
                        boolean isDetailedMetrics,
+                       boolean isCreditBased,
                        MetricGroup inputGroup,
                        SingleInputGate[] inputGates) {
                registerInputMetrics(
                        isDetailedMetrics,
+                       isCreditBased,
                        inputGroup,
                        inputGroup.addGroup(METRIC_GROUP_BUFFERS),
                        inputGates);
        }
 
        private static void registerInputMetrics(
                        boolean isDetailedMetrics,
+                       boolean isCreditBased,
                        MetricGroup inputGroup,
                        MetricGroup buffersGroup,
                        SingleInputGate[] inputGates) {
                if (isDetailedMetrics) {
                        InputGateMetrics.registerQueueLengthMetrics(inputGroup, 
inputGates);
                }
+
                buffersGroup.gauge(METRIC_INPUT_QUEUE_LENGTH, new 
InputBuffersGauge(inputGates));
+
+               if (isCreditBased) {
+                       FloatingBuffersUsageGauge floatingBuffersUsageGauge = 
new FloatingBuffersUsageGauge(inputGates);
+                       ExclusiveBuffersUsageGauge exclusiveBuffersUsageGauge = 
new ExclusiveBuffersUsageGauge(inputGates);
+
+                       
buffersGroup.gauge(METRIC_INPUT_EXCLUSIVE_BUFFERS_USAGE, 
exclusiveBuffersUsageGauge);
+                       buffersGroup.gauge(METRIC_INPUT_FLOATING_BUFFERS_USAGE, 
floatingBuffersUsageGauge);
+                       buffersGroup.gauge(METRIC_INPUT_POOL_USAGE, new 
CreditBasedInputBuffersUsageGauge(floatingBuffersUsageGauge,
+                               exclusiveBuffersUsageGauge, inputGates));
+               } else {
+                       buffersGroup.gauge(METRIC_INPUT_POOL_USAGE, new 
InputBufferPoolUsageGauge(inputGates));
+               }
                buffersGroup.gauge(METRIC_INPUT_POOL_USAGE, new 
InputBufferPoolUsageGauge(inputGates));
 
 Review comment:
   should remove this, it was already done in above else.

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