]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: cleanups to optracker code 21371/head
authorJohn Spray <john.spray@redhat.com>
Thu, 12 Apr 2018 09:26:12 +0000 (10:26 +0100)
committerJohn Spray <john.spray@redhat.com>
Thu, 12 Apr 2018 10:19:41 +0000 (11:19 +0100)
* Make the types of the configuration options
  TYPE_SECS instead of numbers.
* Remove unused 'filterstr' argument handling,
  this argument is not part of the mon's admin
  socket command definitions.

Signed-off-by: John Spray <john.spray@redhat.com>
src/common/options.cc
src/mon/Monitor.cc

index fb6914d0dda679f3ede491af561ccdb15c1d0ac4..bea17832b64bc43ec526fa26379434e788d9e159 100644 (file)
@@ -1105,9 +1105,10 @@ std::vector<Option> get_global_options() {
     .set_default(true)
     .set_description("enable/disable MON op tracking"),
 
-    Option("mon_op_complaint_time", Option::TYPE_FLOAT, Option::LEVEL_ADVANCED)
+    Option("mon_op_complaint_time", Option::TYPE_SECS, Option::LEVEL_ADVANCED)
     .set_default(30)
-    .set_description("time in seconds to consider a MON OP blocked after no updates"),
+    .set_description("time after which to consider a monitor operation blocked "
+                     "after no updates"),
 
     Option("mon_op_log_threshold", Option::TYPE_INT, Option::LEVEL_ADVANCED)
     .set_default(5)
@@ -1117,7 +1118,7 @@ std::vector<Option> get_global_options() {
     .set_default(20)
     .set_description("max number of completed ops to track"),
 
-    Option("mon_op_history_duration", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
+    Option("mon_op_history_duration", Option::TYPE_SECS, Option::LEVEL_ADVANCED)
     .set_default(600)
     .set_description("expiration time in seconds of historical MON OPS"),
 
@@ -1125,9 +1126,9 @@ std::vector<Option> get_global_options() {
     .set_default(20)
     .set_description("max number of slow historical MON OPS to keep"),
 
-    Option("mon_op_history_slow_op_threshold", Option::TYPE_FLOAT, Option::LEVEL_ADVANCED)
-    .set_default(10.0)
-    .set_description("duration time in seconds of an op to be considered as a historical slow op"),
+    Option("mon_op_history_slow_op_threshold", Option::TYPE_SECS, Option::LEVEL_ADVANCED)
+    .set_default(10)
+    .set_description("duration of an op to be considered as a historical slow op"),
 
     Option("mon_data", Option::TYPE_STR, Option::LEVEL_ADVANCED)
     .set_flag(Option::FLAG_NO_MON_UPDATE)
index 559b261b8f7b00b6c4d905a6274d21170ea07821..de3f2e520c901570f5ae7bec348c23327f81d1af 100644 (file)
@@ -179,12 +179,15 @@ Monitor::Monitor(CephContext* cct_, string nm, MonitorDBStore *s,
 
   update_log_clients();
 
-  op_tracker.set_complaint_and_threshold(g_conf->get_val<double>("mon_op_complaint_time"),                              
-                                         g_conf->get_val<int64_t>("mon_op_log_threshold"));
-  op_tracker.set_history_size_and_duration(g_conf->get_val<uint64_t>("mon_op_history_size"),
-                                           g_conf->get_val<uint64_t>("mon_op_history_duration"));
-  op_tracker.set_history_slow_op_size_and_threshold(g_conf->get_val<uint64_t>("mon_op_history_slow_op_size"),
-                                                    g_conf->get_val<double>("mon_op_history_slow_op_threshold"));
+  op_tracker.set_complaint_and_threshold(
+      g_conf->get_val<std::chrono::seconds>("mon_op_complaint_time").count(),
+      g_conf->get_val<int64_t>("mon_op_log_threshold"));
+  op_tracker.set_history_size_and_duration(
+      g_conf->get_val<uint64_t>("mon_op_history_size"),
+      g_conf->get_val<std::chrono::seconds>("mon_op_history_duration").count());
+  op_tracker.set_history_slow_op_size_and_threshold(
+      g_conf->get_val<uint64_t>("mon_op_history_slow_op_size"),
+      g_conf->get_val<std::chrono::seconds>("mon_op_history_slow_op_threshold").count());
 
   paxos = new Paxos(this, "paxos");
 
@@ -274,14 +277,6 @@ void Monitor::do_admin_command(std::string_view command, const cmdmap_t& cmdmap,
     << "from='admin socket' entity='admin socket' "
     << "cmd='" << command << "' args=" << args << ": dispatch";
 
-  set<string> filters;
-  vector<string> filter_str;
-  if (cmd_getval(cct, cmdmap, "filterstr", filter_str)) {                                                                                                                           
-      copy(filter_str.begin(), filter_str.end(),
-          inserter(filters, filters.end()));
-  }
-
-
   if (command == "mon_status") {
     get_mon_status(f.get(), ss);
     if (f)
@@ -340,7 +335,7 @@ void Monitor::do_admin_command(std::string_view command, const cmdmap_t& cmdmap,
         please enable \"mon_enable_op_tracker\", and the tracker will start to track new ops received afterwards.";
     }
   } else if (command == "dump_historic_slow_ops") {
-    if (op_tracker.dump_historic_slow_ops(f.get(), filters)) {
+    if (op_tracker.dump_historic_slow_ops(f.get(), {})) {
       f->flush(ss);
     } else {
       ss << "op_tracker tracking is not enabled now, so no ops are tracked currently, even those get stuck. \
@@ -5458,7 +5453,7 @@ vector<DaemonHealthMetric> Monitor::get_health_metrics()
   utime_t oldest_secs;
   const utime_t now = ceph_clock_now();
   auto too_old = now;
-  too_old -= g_conf->get_val<double>("mon_op_complaint_time");
+  too_old -= g_conf->get_val<std::chrono::seconds>("mon_op_complaint_time").count();
   int slow = 0;
 
   auto count_slow_ops = [&](TrackedOp& op) {