]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/admin: add optional prefix arg to "perf dump_seastar"
authorKefu Chai <kchai@redhat.com>
Sat, 15 May 2021 06:35:31 +0000 (14:35 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 18 May 2021 10:05:33 +0000 (18:05 +0800)
so we can filter the dumped metrics by their prefix

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/admin/osd_admin.cc

index 511a62d443176fccf718240ccab16d9d7ebb8c45..c5920ded7f9710f62da9937170243db1c0fd7c7d 100644 (file)
@@ -194,7 +194,7 @@ class SeastarMetricsHook : public AdminSocketHook {
 public:
  SeastarMetricsHook()  :
    AdminSocketHook("perf dump_seastar",
-      "",
+      "name=group,type=CephString,req=false",
       "dump current configured seastar metrics and their values")
  {}
  seastar::future<tell_result_t> call(const cmdmap_t& cmdmap,
@@ -202,8 +202,13 @@ public:
              ceph::bufferlist&& input) const final
  {
    std::unique_ptr<Formatter> f{Formatter::create(format, "json-pretty", "json-pretty")};
+   std::string prefix;
+   cmd_getval(cmdmap, "group", prefix);
    f->open_object_section("perf_dump_seastar");
    for (const auto& [full_name, metric_family]: seastar::scollectd::get_value_map()) {
+     if (!prefix.empty() && full_name.compare(0, prefix.size(), prefix) != 0) {
+       continue;
+     }
      for (const auto& [labels, metric] : metric_family) {
        if (metric && metric->is_enabled()) {
         dump_metric_value(f.get(), full_name, *metric);