ChenSammi commented on code in PR #3875:
URL: https://github.com/apache/ozone/pull/3875#discussion_r1045558207


##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/RocksDBStoreMBean.java:
##########
@@ -61,22 +69,70 @@ public class RocksDBStoreMBean implements DynamicMBean, 
MetricsSource {
       LoggerFactory.getLogger(RocksDBStoreMBean.class);
 
   public static final String ROCKSDB_CONTEXT_PREFIX = "Rocksdb_";
+  public static final String ROCKSDB_PROPERTY_PREFIX = "rocksdb.";
+
+  // RocksDB properties
+  private final String[][] cfPros = {
+      // 1 if a memtable flush is pending; otherwise, returns 0
+      {"mem-table-flush-pending", "false", ""},
+      // estimated total number of bytes compaction needs to rewrite to get
+      // all levels down to under target size.
+      {"estimate-pending-compaction-bytes", "true", ""},
+      // 1 if at least one compaction is pending; otherwise, returns 0.
+      {"compaction-pending", "false", ""},
+      // block cache capacity
+      {"block-cache-capacity", "true", ""},
+      // the memory size for the entries residing in block cache
+      {"block-cache-usage", "true", ""},
+      // the memory size for the entries being pinned
+      {"block-cache-pinned-usage", "true", ""},
+      // number of level to which L0 data will be compacted.
+      {"base-level", "false", ""},
+      // approximate active mem table size (bytes)
+      {"cur-size-active-mem-table", "true", ""},
+      // approximate size of active and unflushed immutable (bytes)
+      {"cur-size-all-mem-tables", "true", ""},
+      // approximate size of active, unflushed immutable, and pinned immutable
+      // memtables (bytes)
+      {"size-all-mem-tables", "true", ""},
+      // number of immutable memtables that have not yet been flushed
+      {"num-immutable-mem-table", "true", ""},
+      // total size (bytes) of all SST files belong to the latest LSM tree
+      {"live-sst-files-size", "true", ""},
+      // estimated number of total keys in memtables and storage(Can be very
+      // wrong according to RocksDB document)
+      {"estimate-num-keys", "true", ""},
+      // estimated memory used for reading SST tables, excluding memory used
+      // in block cache (e.g., filter and index blocks)
+      {"estimate-table-readers-mem", "true", ""}
+  };
 
-  public RocksDBStoreMBean(Statistics statistics, String dbName) {
+  // level-x sst file info (Global)
+  private static final String NUM_FILES_AT_LEVEL = "num_files_at_level";
+  private static final String SIZE_AT_LEVEL = "size_at_level";
+
+  public RocksDBStoreMBean(Statistics statistics, RocksDatabase db,
+      String dbName) {
     this.contextName = ROCKSDB_CONTEXT_PREFIX + dbName;
     this.statistics = statistics;
+    this.rocksDB = db;
     histogramAttributes.add("Average");
     histogramAttributes.add("Median");
     histogramAttributes.add("Percentile95");
     histogramAttributes.add("Percentile99");
     histogramAttributes.add("StandardDeviation");
+    histogramAttributes.add("Max");
+
+    // To get the metric name complied with prometheus naming rule
+    for (String[] property : cfPros) {
+      property[2] = property[0].replace("-", "_");

Review Comment:
   I checked all the metrics, except HistogramData and TickerTypeData are in 
upper-case, all other metrics are in lower-case.  So probably we should covert 
HistogramData and TickerTypeData to lower-case to be consistent. We should do 
it in another patch. 



##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/RocksDBStoreMBean.java:
##########
@@ -179,6 +234,7 @@ public void getMetrics(MetricsCollector metricsCollector, 
boolean b) {
     MetricsRecordBuilder rb = metricsCollector.addRecord(contextName);
     getHistogramData(rb);
     getTickerTypeData(rb);
+    getDBPropertyData(rb);

Review Comment:
   Make sense. Let me check the code. 



##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/RocksDBStoreMBean.java:
##########
@@ -61,22 +69,70 @@ public class RocksDBStoreMBean implements DynamicMBean, 
MetricsSource {
       LoggerFactory.getLogger(RocksDBStoreMBean.class);
 
   public static final String ROCKSDB_CONTEXT_PREFIX = "Rocksdb_";
+  public static final String ROCKSDB_PROPERTY_PREFIX = "rocksdb.";
+
+  // RocksDB properties

Review Comment:
   Sure.



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

Reply via email to