From: Ernesto Puerta Date: Mon, 16 Sep 2019 10:56:26 +0000 (+0200) Subject: mgr: change perf-counter precision to float X-Git-Tag: v15.1.0~1289^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3569829014434c8134e2623a148ba4b7e14e1d19;p=ceph.git mgr: change perf-counter precision to float 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 --- diff --git a/qa/tasks/mgr/dashboard/test_osd.py b/qa/tasks/mgr/dashboard/test_osd.py index c6c7c5aadd68..fdd84ac7ea72 100644 --- a/qa/tasks/mgr/dashboard/test_osd.py +++ b/qa/tasks/mgr/dashboard/test_osd.py @@ -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') diff --git a/src/mgr/ActivePyModules.cc b/src/mgr/ActivePyModules.cc index 40250a549a5f..2943b8ce60a3 100644 --- a/src/mgr/ActivePyModules.cc +++ b/src/mgr/ActivePyModules.cc @@ -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 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); } };