]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
TrackedOp: Make history_slow_op_threshold a float 52636/head
authorJoshua Baergen <jbaergen@digitalocean.com>
Mon, 24 Jul 2023 16:36:21 +0000 (10:36 -0600)
committerJoshua Baergen <jbaergen@digitalocean.com>
Mon, 31 Jul 2023 18:34:07 +0000 (12:34 -0600)
It's already the case that osd_op_history_slow_op_threshold as well as
the computed op duration are floating-point, but we were losing this
precision within OpHistory.

Fixes: https://tracker.ceph.com/issues/62169
Signed-off-by: Joshua Baergen <jbaergen@digitalocean.com>
src/common/TrackedOp.cc
src/common/TrackedOp.h

index d63bdb8f9a5744a2d91237f3eefafeab587f6cd4..1a3186b9fa002d4159ecc81698c8b3a1c85b42c9 100644 (file)
@@ -204,7 +204,7 @@ void OpHistory::dump_slow_ops(utime_t now, Formatter *f, set<string> filters)
   cleanup(now);
   f->open_object_section("OpHistory slow ops");
   f->dump_int("num to keep", history_slow_op_size.load());
-  f->dump_int("threshold to keep", history_slow_op_threshold.load());
+  f->dump_float("threshold to keep", history_slow_op_threshold.load());
   {
     f->open_array_section("Ops");
     for (set<pair<utime_t, TrackedOpRef> >::const_iterator i =
index 31afba1853e3af3691d0247608f8e90cc231dc6f..167375dc44deb8d04111992363eff0ea3b0915f5 100644 (file)
@@ -67,7 +67,7 @@ class OpHistory {
   std::atomic_size_t history_size{0};
   std::atomic_uint32_t history_duration{0};
   std::atomic_size_t history_slow_op_size{0};
-  std::atomic_uint32_t history_slow_op_threshold{0};
+  std::atomic<float> history_slow_op_threshold{0};
   std::atomic_bool shutdown{false};
   OpHistoryServiceThread opsvc;
   friend class OpHistoryServiceThread;
@@ -110,7 +110,7 @@ public:
     history_size = new_size;
     history_duration = new_duration;
   }
-  void set_slow_op_size_and_threshold(size_t new_size, uint32_t new_threshold) {
+  void set_slow_op_size_and_threshold(size_t new_size, float new_threshold) {
     history_slow_op_size = new_size;
     history_slow_op_threshold = new_threshold;
   }
@@ -139,7 +139,7 @@ public:
   void set_history_size_and_duration(uint32_t new_size, uint32_t new_duration) {
     history.set_size_and_duration(new_size, new_duration);
   }
-  void set_history_slow_op_size_and_threshold(uint32_t new_size, uint32_t new_threshold) {
+  void set_history_slow_op_size_and_threshold(uint32_t new_size, float new_threshold) {
     history.set_slow_op_size_and_threshold(new_size, new_threshold);
   }
   bool is_tracking() const {