You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2023/01/19 11:51:33 UTC

[GitHub] [ozone] xBis7 commented on a diff in pull request #4164: HDDS-7506. [Snapshot] Expose more snapshot metrics under OMMetrics

xBis7 commented on code in PR #4164:
URL: https://github.com/apache/ozone/pull/4164#discussion_r1081158602


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java:
##########
@@ -1623,6 +1629,51 @@ public void restart() throws IOException {
     omState = State.RUNNING;
   }
 
+  /**
+   * Iterate the Snapshot table, check the status
+   * for every snapshot and update OMMetrics.
+   */
+  private void updateActiveSnapshotMetrics()
+      throws IOException {
+
+    long activeGauge = 0;
+    long deletedGauge = 0;
+    long reclaimedGauge = 0;
+
+    try (TableIterator<String, ? extends
+        KeyValue<String, SnapshotInfo>> keyIter =
+             metadataManager.getSnapshotInfoTable().iterator()) {
+      Table.KeyValue<String, SnapshotInfo> keyValue;
+
+      List<SnapshotInfo> snapshotInfoList = new ArrayList<>();
+
+      while (keyIter.hasNext()) {
+        keyValue = keyIter.next();
+        snapshotInfoList.add(keyValue.getValue());
+      }
+
+      for (SnapshotInfo info : snapshotInfoList) {

Review Comment:
   You are right, this is unnecessary.



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org