You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-dev@hadoop.apache.org by GitBox <gi...@apache.org> on 2019/10/30 04:22:39 UTC

[GitHub] [hadoop-ozone] avijayanhwx commented on a change in pull request #101: HDDS-2364. Add OM metrics to find the false positive rate for the keyMayExist.

avijayanhwx commented on a change in pull request #101: HDDS-2364. Add OM metrics to find the false positive rate for the keyMayExist.
URL: https://github.com/apache/hadoop-ozone/pull/101#discussion_r340426043
 
 

 ##########
 File path: hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/db/RDBMetrics.java
 ##########
 @@ -0,0 +1,75 @@
+/*
+ * 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.hdds.utils.db;
+
+import org.apache.hadoop.metrics2.MetricsSystem;
+import org.apache.hadoop.metrics2.annotation.Metric;
+import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
+import org.apache.hadoop.metrics2.lib.MutableCounterLong;
+
+import com.google.common.annotations.VisibleForTesting;
+
+/**
+ * Class to hold RocksDB metrics.
+ */
+public class RDBMetrics {
+
+  private static final String SOURCE_NAME =
+      RDBMetrics.class.getSimpleName();
+
+  public RDBMetrics() {
+  }
+
+  public static RDBMetrics create() {
+    MetricsSystem ms = DefaultMetricsSystem.instance();
+    return ms.register(SOURCE_NAME,
+        "Rocks DB Metrics",
+        new RDBMetrics());
+  }
+
+  private @Metric MutableCounterLong numDBKeyMayExistChecks;
+  private @Metric MutableCounterLong numDBKeyMayExistMisses;
+
+
+  public void incNumDBKeyMayExistChecks() {
+    numDBKeyMayExistChecks.incr();
+  }
+
+  public void incNumDBKeyMayExistMisses() {
+    numDBKeyMayExistMisses.incr();
+  }
+
+
+  @VisibleForTesting
+  public long getNumDBKeyMayExistChecks() {
+    return numDBKeyMayExistChecks.value();
+  }
+
+  @VisibleForTesting
+  public long getNumDBKeyMayExistMisses() {
+    return numDBKeyMayExistMisses.value();
+  }
+
+  public void unRegister() {
+    MetricsSystem ms = DefaultMetricsSystem.instance();
 
 Review comment:
   Good catch. Will add it.

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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-dev-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-dev-help@hadoop.apache.org