adoroszlai commented on a change in pull request #3180: URL: https://github.com/apache/ozone/pull/3180#discussion_r825352832
########## File path: hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/lock/OMLockMetrics.java ########## @@ -0,0 +1,137 @@ +/** + * 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.hadoop.ozone.om.lock; + +import org.apache.hadoop.hdds.annotation.InterfaceAudience; +import org.apache.hadoop.metrics2.MetricsSystem; +import org.apache.hadoop.metrics2.annotation.Metric; +import org.apache.hadoop.metrics2.annotation.Metrics; +import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem; +import org.apache.hadoop.metrics2.lib.MutableCounterLong; +import org.apache.hadoop.metrics2.lib.MutableGaugeLong; +import org.apache.hadoop.ozone.OzoneConsts; + +/** + * This class is for maintaining the various Ozone Manager Lock Metrics. + */ [email protected] +@Metrics(about = "Ozone Manager Lock Metrics", context = OzoneConsts.OZONE) +public class OMLockMetrics { + private static final String SOURCE_NAME = + OMLockMetrics.class.getSimpleName(); + + private @Metric MutableGaugeLong longestReadLockWaitingTimeMs; + private @Metric MutableGaugeLong longestReadLockHeldTimeMs; + private @Metric MutableCounterLong numReadLockLongWaiting; + private @Metric MutableCounterLong numReadLockLongHeld; Review comment: There are at least two problems with threshold config: 1. It provides very little information. We only get the number of cases when the time exceeded the threshold. No information about the total number of cases, the distribution, etc. 2. We need to come up with the critical value up front. OM needs to be restarted to change the value. If we keep track of a more complex stat with min/max/avg/stddev, we get a more complete picture of how long locks are held. Therefore I don't think we even need to count the instances when time exceeded the threshold, thus the threshold is unnecessary, too. -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
