]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/DynamicPerfStats: remove the dependency on classic osds
authorXuehan Xu <xuxuehan@qianxin.com>
Tue, 24 Dec 2024 07:24:14 +0000 (15:24 +0800)
committerXuehan Xu <xuxuehan@qianxin.com>
Fri, 7 Feb 2025 03:39:57 +0000 (11:39 +0800)
Signed-off-by: Xuehan Xu <xuxuehan@qianxin.com>
src/osd/DynamicPerfStats.h
src/osd/PrimaryLogPG.cc

index 1c6c26c712d80303bd1bcee2e9a155b9bf724834..c9ea7d095172c19688560cde0eae27f75bdc9323 100644 (file)
@@ -7,8 +7,6 @@
 #include "include/random.h"
 #include "messages/MOSDOp.h"
 #include "mgr/OSDPerfMetricTypes.h"
-#include "osd/OSD.h"
-#include "osd/OpRequest.h"
 
 class DynamicPerfStats {
 public:
@@ -54,7 +52,8 @@ public:
     return !data.empty();
   }
 
-  void add(const OSDService *osd, const pg_info_t &pg_info, const OpRequest& op,
+  template <typename OpRequest>
+  void add(int osd, const pg_info_t &pg_info, const OpRequest& op,
            uint64_t inb, uint64_t outb, const utime_t &latency) {
 
     auto update_counter_fnc =
@@ -111,18 +110,22 @@ public:
         };
 
     auto get_subkey_fnc =
-        [&osd, &pg_info, &op](const OSDPerfMetricSubKeyDescriptor &d,
+        [osd, &pg_info, &op](const OSDPerfMetricSubKeyDescriptor &d,
                               OSDPerfMetricSubKey *sub_key) {
           ceph_assert(d.is_supported());
 
-          auto m = op.get_req<MOSDOp>();
+          auto m = op.template get_req<MOSDOp>();
           std::string match_string;
           switch(d.type) {
           case OSDPerfMetricSubKeyType::CLIENT_ID:
             match_string = stringify(m->get_reqid().name);
             break;
           case OSDPerfMetricSubKeyType::CLIENT_ADDRESS:
+#ifdef WITH_SEASTAR
+           match_string = stringify(op.get_connection()->get_peer_addr());
+#else
             match_string = stringify(m->get_connection()->get_peer_addr());
+#endif
             break;
           case OSDPerfMetricSubKeyType::POOL_ID:
             match_string = stringify(m->get_spg().pool());
@@ -131,7 +134,7 @@ public:
             match_string = m->get_hobj().nspace;
             break;
           case OSDPerfMetricSubKeyType::OSD_ID:
-            match_string = stringify(osd->get_nodeid());
+            match_string = stringify(osd);
             break;
           case OSDPerfMetricSubKeyType::PG_ID:
             match_string = stringify(pg_info.pgid);
index baa507049385336428e9a2c21cb5d5c979fef736..877cdcaa32ea2690d5572acd4891ee3bf13ebe60 100644 (file)
@@ -4465,7 +4465,7 @@ void PrimaryLogPG::log_op_stats(const OpRequest& op,
           << " lat " << latency << dendl;
 
   if (m_dynamic_perf_stats.is_enabled()) {
-    m_dynamic_perf_stats.add(osd, info, op, inb, outb, latency);
+    m_dynamic_perf_stats.add(osd->get_nodeid(), info, op, inb, outb, latency);
   }
 }