]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: change perf-counter precision to float 30400/head
authorErnesto Puerta <epuertat@redhat.com>
Mon, 16 Sep 2019 10:56:26 +0000 (12:56 +0200)
committerErnesto Puerta <epuertat@redhat.com>
Fri, 27 Sep 2019 13:00:24 +0000 (15:00 +0200)
Instead of integer nsecs, as added in
https://github.com/ceph/ceph/pull/28882, this recovers second units, but
with double (potentially nsec precision). This will fix some issues
caused by the mixing of second-based and nsec-based timestamps
(https://github.com/ceph/ceph/pull/28603).

Fixes: https://tracker.ceph.com/issues/41867
Signed-off-by: Ernesto Puerta <epuertat@redhat.com>
qa/tasks/mgr/dashboard/test_osd.py
src/mgr/ActivePyModules.cc

index c6c7c5aadd6875737c25a2afb6c5e74beeb8c68a..fdd84ac7ea728604827257eb17e2a1e7d369aed9 100644 (file)
@@ -37,7 +37,7 @@ class OsdTest(DashboardTestCase):
                                                     'op_r', 'op_w'])
         self.assert_in_and_not_none(data['stats_history'], ['op_out_bytes', 'op_in_bytes'])
         self.assertSchema(data['stats_history']['op_out_bytes'],
-                          JList(JTuple([JLeaf(int), JLeaf(float)])))
+                          JList(JTuple([JLeaf(float), JLeaf(float)])))
 
     def test_details(self):
         data = self._get('/api/osd/0')
index 40250a549a5f693794eaffea29aafe84772b701a..2943b8ce60a31d502f67091c02516f07f7fc081a 100644 (file)
@@ -34,7 +34,7 @@
 #define dout_context g_ceph_context
 #define dout_subsys ceph_subsys_mgr
 #undef dout_prefix
-#define dout_prefix *_dout << "mgr " << __func__ << " "    
+#define dout_prefix *_dout << "mgr " << __func__ << " "
 
 ActivePyModules::ActivePyModules(PyModuleConfig &module_config_,
           std::map<std::string, std::string> store_data,
@@ -535,7 +535,7 @@ bool ActivePyModules::get_config(const std::string &module_name,
   dout(20) << " key: " << global_key << dendl;
 
   std::lock_guard lock(module_config.lock);
-  
+
   auto i = module_config.config.find(global_key);
   if (i != module_config.config.end()) {
     *val = i->second;
@@ -596,7 +596,7 @@ PyObject *ActivePyModules::get_store_prefix(const std::string &module_name,
   dout(4) << __func__ << " prefix: " << global_prefix << dendl;
 
   PyFormatter f;
-  
+
   for (auto p = store_cache.lower_bound(global_prefix);
        p != store_cache.end() && p->first.find(global_prefix) == 0;
        ++p) {
@@ -610,7 +610,7 @@ void ActivePyModules::set_store(const std::string &module_name,
 {
   const std::string global_key = PyModule::config_prefix
                                    + module_name + "/" + key;
-  
+
   Command set_cmd;
   {
     std::lock_guard l(lock);
@@ -718,7 +718,7 @@ PyObject* ActivePyModules::get_counter_python(
       const auto &avg_data = counter_instance.get_data_avg();
       for (const auto &datapoint : avg_data) {
         f.open_array_section("datapoint");
-        f.dump_unsigned("t", datapoint.t.to_nsec());
+        f.dump_float("t", datapoint.t);
         f.dump_unsigned("s", datapoint.s);
         f.dump_unsigned("c", datapoint.c);
         f.close_section();
@@ -727,7 +727,7 @@ PyObject* ActivePyModules::get_counter_python(
       const auto &data = counter_instance.get_data();
       for (const auto &datapoint : data) {
         f.open_array_section("datapoint");
-        f.dump_unsigned("t", datapoint.t.to_nsec());
+        f.dump_float("t", datapoint.t);
         f.dump_unsigned("v", datapoint.v);
         f.close_section();
       }
@@ -748,12 +748,12 @@ PyObject* ActivePyModules::get_latest_counter_python(
   {
     if (counter_type.type & PERFCOUNTER_LONGRUNAVG) {
       const auto &datapoint = counter_instance.get_latest_data_avg();
-      f.dump_unsigned("t", datapoint.t.to_nsec());
+      f.dump_float("t", datapoint.t);
       f.dump_unsigned("s", datapoint.s);
       f.dump_unsigned("c", datapoint.c);
     } else {
       const auto &datapoint = counter_instance.get_latest_data();
-      f.dump_unsigned("t", datapoint.t.to_nsec());
+      f.dump_float("t", datapoint.t);
       f.dump_unsigned("v", datapoint.v);
     }
   };