Aitozi 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_r298950182
########## 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, Review comment: ok, very thanks ---------------------------------------------------------------- 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