azagrebin commented on a change in pull request #8485: [FLINK-12555] Introduce an encapsulated metric group layout for shuffle API URL: https://github.com/apache/flink/pull/8485#discussion_r291084241
########## File path: flink-runtime/src/main/java/org/apache/flink/runtime/io/network/metrics/NettyShuffleMetricFactory.java ########## @@ -0,0 +1,148 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.runtime.io.network.metrics; + +import org.apache.flink.metrics.Gauge; +import org.apache.flink.metrics.MetricGroup; +import org.apache.flink.runtime.io.network.api.writer.ResultPartitionWriter; +import org.apache.flink.runtime.io.network.buffer.NetworkBufferPool; +import org.apache.flink.runtime.io.network.partition.ResultPartition; +import org.apache.flink.runtime.io.network.partition.consumer.InputGate; +import org.apache.flink.runtime.io.network.partition.consumer.SingleInputGate; + +import static org.apache.flink.util.Preconditions.checkNotNull; + +/** + * Factory for netty shuffle service metrics. + */ +public class NettyShuffleMetricFactory { + + // deprecated metric groups + + @SuppressWarnings("DeprecatedIsStillUsed") + @Deprecated + private static final String METRIC_GROUP_NETWORK_DEPRECATED = "Network"; + @SuppressWarnings("DeprecatedIsStillUsed") + @Deprecated + private static final String METRIC_GROUP_BUFFERS_DEPRECATED = "buffers"; + + // shuffle environment level metrics: Shuffle.Netty.* + + private static final String METRIC_TOTAL_MEMORY_SEGMENT = "TotalMemorySegments"; + private static final String METRIC_AVAILABLE_MEMORY_SEGMENT = "AvailableMemorySegments"; + + // task level metric group structure: Shuffle.Netty.<Input|Output>.Buffers + + private static final String METRIC_GROUP_SHUFFLE = "Shuffle"; + private static final String METRIC_GROUP_NETTY = "Netty"; + public static final String METRIC_GROUP_OUTPUT = "Output"; + public static final String METRIC_GROUP_INPUT = "Input"; + public static final String METRIC_GROUP_BUFFERS = "Buffers"; + + // task level output metrics: Shuffle.Netty.Output.* + + private static final String METRIC_OUTPUT_QUEUE_LENGTH = "outputQueueLength"; + private static final String METRIC_OUTPUT_POOL_USAGE = "outPoolUsage"; + + // task level output metrics: Shuffle.Netty.Input.* + + private static final String METRIC_INPUT_QUEUE_LENGTH = "inputQueueLength"; + private static final String METRIC_INPUT_POOL_USAGE = "inPoolUsage"; + + private NettyShuffleMetricFactory() { Review comment: This is an indicator that it is a utility stateless class with only static methods which is not supposed to be instantiated. ---------------------------------------------------------------- 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] With regards, Apache Git Services
