]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson: fix dump_metrics skipping metrics argument. Add minimal qa test for the... 67186/head
authorJose J Palacios-Perez <perezjos@uk.ibm.com>
Tue, 3 Feb 2026 14:19:27 +0000 (14:19 +0000)
committerJose J Palacios-Perez <perezjos@uk.ibm.com>
Tue, 3 Feb 2026 14:19:27 +0000 (14:19 +0000)
Signed-off-by: Jose J Palacios-Perez <perezjos@uk.ibm.com>
qa/suites/crimson-rados/singleton/all/osd-dump-metrics.yaml [new file with mode: 0644]
qa/workunits/cephtool/test_crimson_dump_metrics.sh [new file with mode: 0755]
src/crimson/admin/osd_admin.cc

diff --git a/qa/suites/crimson-rados/singleton/all/osd-dump-metrics.yaml b/qa/suites/crimson-rados/singleton/all/osd-dump-metrics.yaml
new file mode 100644 (file)
index 0000000..e22c901
--- /dev/null
@@ -0,0 +1,30 @@
+roles:
+- - mon.a
+  - mon.b
+  - mon.c
+  - mgr.x
+  - osd.0
+  - osd.1
+  - osd.2
+  - client.0
+openstack:
+  - volumes: # attached to each instance
+      count: 3
+      size: 10 # GB
+tasks:
+- install:
+- ceph:
+    pre-mgr-commands:
+      - sudo ceph config set mgr mgr_pool false --force
+    log-ignorelist:
+      - but it is still running
+      - overall HEALTH_
+    conf:
+      osd:
+        osd min pg log entries: 5
+        crimson cpu num: 2
+      global:
+- workunit:
+    clients:
+      client.0:
+        - cephtool/test_crimson_dump_metrics.sh
diff --git a/qa/workunits/cephtool/test_crimson_dump_metrics.sh b/qa/workunits/cephtool/test_crimson_dump_metrics.sh
new file mode 100755 (executable)
index 0000000..10b373a
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+. $(dirname $0)/../../standalone/ceph-helpers.sh
+
+set -x
+
+function test_dump_metrics() {
+    # Ensure can get dump_metrics full
+    ceph tell osd.0 dump_metrics 2>/dev/null > /tmp/dump_metrics_full.json || true
+
+    # Ensure can get dump_metrics reactor_utilization: can be done with each metric name individually
+    ceph tell osd.0 dump_metrics reactor_utilization 2>/dev/null > /tmp/dump_metrics_reactor.json || true
+
+    # The number of occurrences must match (must be greater than zero)
+    full_count=$(grep -c reactor_utilization /tmp/dump_metrics_full.json)
+    reactor_count=$(grep -c reactor_utilization /tmp/dump_metrics_reactor.json)
+    
+    [ $full_count -gt 0 ] || return 1
+    [ $reactor_count -gt 0 ] || return 1
+    [ $full_count -eq $reactor_count ] || return 1
+
+    # Remove auxiliary files
+    rm -f /tmp/dump_metrics_full.json /tmp/dump_metrics_reactor.json
+    return 0 # success
+}
+
+# A more complete test: traverse the "metrics" section and ensure each metric contains the expected attributes
+
+test_dump_metrics || { echo "test_dump_metrics failed"; exit 1; }
+
+echo "OK"
+
index 8e73180edb07bdead58a252f9aaf4f9b4cc0db5e..c2f46e0bfa364b6d8af982dda8ef84c6f710b8d1 100644 (file)
@@ -347,7 +347,7 @@ public:
        seastar::scollectd::get_value_map(),
        f,
        [prefix](const auto &full_name) {
-         return prefix.empty() || full_name.compare(0, prefix.size(), prefix) != 0;
+         return prefix.empty() || full_name.compare(0, prefix.size(), prefix) == 0;
        });
     });
     fref->close_section();