This is an automated email from the ASF dual-hosted git repository.

wangdan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git


The following commit(s) were added to refs/heads/master by this push:
     new d14bfae8b feat(new_metrics): support `server_stat` command showing 
some important server-level metrics (part 3) (#2385)
d14bfae8b is described below

commit d14bfae8b9758a1c9f39b5f09d65c2bd449aa69d
Author: Dan Wang <[email protected]>
AuthorDate: Wed Mar 18 19:55:09 2026 +0800

    feat(new_metrics): support `server_stat` command showing some important 
server-level metrics (part 3) (#2385)
    
    https://github.com/apache/incubator-pegasus/issues/2382
    
    Add metrics related to the number of RocksDB as the 3rd part to be shown by
    `server_stat` command.
---
 src/shell/commands/node_management.cpp | 59 ++++++++++++++++++++++++++--------
 1 file changed, 45 insertions(+), 14 deletions(-)

diff --git a/src/shell/commands/node_management.cpp 
b/src/shell/commands/node_management.cpp
index 8b8804287..c8614b203 100644
--- a/src/shell/commands/node_management.cpp
+++ b/src/shell/commands/node_management.cpp
@@ -245,8 +245,23 @@ dsn::metric_filters server_stat_filters()
 {
     dsn::metric_filters filters;
     filters.with_metric_fields = {dsn::kMetricNameField, 
dsn::kMetricSingleValueField};
-    filters.entity_types = {"server"};
-    filters.entity_metrics = {"virtual_mem_usage_mb", "resident_mem_usage_mb"};
+    filters.entity_types = {"server", "replica"};
+    filters.entity_metrics = {
+        "virtual_mem_usage_mb",
+        "resident_mem_usage_mb",
+        "total_replicas",
+        "opening_replicas",
+        "closing_replicas",
+        "inactive_replicas",
+        "error_replicas",
+        "primary_replicas",
+        "secondary_replicas",
+        "learning_replicas",
+        "splitting_replicas",
+        "rdb_block_cache_mem_usage_bytes",
+        "rdb_manual_compact_queued_tasks",
+        "rdb_manual_compact_running_tasks",
+    };
     return filters;
 }
 
@@ -299,6 +314,10 @@ struct replica_server_stats
     double learning_replicas{0.0};
     double splitting_replicas{0.0};
 
+    double rdb_block_cache_mem_usage_bytes{0.0};
+    double rdb_manual_compact_queued_tasks{0.0};
+    double rdb_manual_compact_running_tasks{0.0};
+
     DEFINE_JSON_SERIALIZATION(virt_mem_mb,
                               res_mem_mb,
                               total_replicas,
@@ -309,7 +328,10 @@ struct replica_server_stats
                               primary_replicas,
                               secondary_replicas,
                               learning_replicas,
-                              splitting_replicas)
+                              splitting_replicas,
+                              rdb_block_cache_mem_usage_bytes,
+                              rdb_manual_compact_queued_tasks,
+                              rdb_manual_compact_running_tasks)
 };
 
 std::pair<bool, std::string>
@@ -321,17 +343,26 @@ aggregate_replica_server_stats(const node_desc &node,
     replica_server_stats stats;
     calcs.create_assignments<total_aggregate_stats>(
         "server",
-        stat_var_map({{"virtual_mem_usage_mb", &stats.virt_mem_mb},
-                      {"resident_mem_usage_mb", &stats.res_mem_mb},
-                      {"total_replicas", &stats.total_replicas},
-                      {"opening_replicas", &stats.opening_replicas},
-                      {"closing_replicas", &stats.closing_replicas},
-                      {"inactive_replicas", &stats.inactive_replicas},
-                      {"error_replicas", &stats.error_replicas},
-                      {"primary_replicas", &stats.primary_replicas},
-                      {"secondary_replicas", &stats.secondary_replicas},
-                      {"learning_replicas", &stats.learning_replicas},
-                      {"splitting_replicas", &stats.splitting_replicas}}));
+        stat_var_map({
+            {"virtual_mem_usage_mb", &stats.virt_mem_mb},
+            {"resident_mem_usage_mb", &stats.res_mem_mb},
+            {"total_replicas", &stats.total_replicas},
+            {"opening_replicas", &stats.opening_replicas},
+            {"closing_replicas", &stats.closing_replicas},
+            {"inactive_replicas", &stats.inactive_replicas},
+            {"error_replicas", &stats.error_replicas},
+            {"primary_replicas", &stats.primary_replicas},
+            {"secondary_replicas", &stats.secondary_replicas},
+            {"learning_replicas", &stats.learning_replicas},
+            {"splitting_replicas", &stats.splitting_replicas},
+            {"rdb_block_cache_mem_usage_bytes", 
&stats.rdb_block_cache_mem_usage_bytes},
+        }));
+    calcs.create_sums<total_aggregate_stats>(
+        "replica",
+        stat_var_map({
+            {"rdb_manual_compact_queued_tasks", 
&stats.rdb_manual_compact_queued_tasks},
+            {"rdb_manual_compact_running_tasks", 
&stats.rdb_manual_compact_running_tasks},
+        }));
 
     const auto command_result = process_parse_metrics_result(
         calcs.aggregate_metrics(query_snapshot_start, query_snapshot_end),


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to