From: David Zafman Date: Tue, 6 Aug 2019 03:57:48 +0000 (-0700) Subject: osd mon mgr: Convert all network ping time output to milliseconds X-Git-Tag: v13.2.7~26^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3b1e22a1407cfafc76090779b5461709ee2357ff;p=ceph.git osd mon mgr: Convert all network ping time output to milliseconds To output milliseconds (usec / 1000), treat as fixed point integers Signed-off-by: David Zafman (cherry picked from commit 9d02e5d39d7b5e2806a5d98bdde24f4584e70528) Conflicts: src/mon/PGMap.cc (trivial) --- diff --git a/src/mgr/ClusterState.cc b/src/mgr/ClusterState.cc index 40ad33d800109..c8082ad102c8f 100644 --- a/src/mgr/ClusterState.cc +++ b/src/mgr/ClusterState.cc @@ -329,21 +329,21 @@ bool ClusterState::asok_command(std::string_view admin_command, const cmdmap_t& f->dump_int("to osd", sitem.to); f->dump_string("interface", (sitem.back ? "back" : "front")); f->open_object_section("average"); - f->dump_unsigned("1min", sitem.times[0]); - f->dump_unsigned("5min", sitem.times[1]); - f->dump_unsigned("15min", sitem.times[2]); + f->dump_format_unquoted("1min", "%s", fixed_u_to_string(sitem.times[0],3).c_str()); + f->dump_format_unquoted("5min", "%s", fixed_u_to_string(sitem.times[1],3).c_str()); + f->dump_format_unquoted("15min", "%s", fixed_u_to_string(sitem.times[2],3).c_str()); f->close_section(); // average f->open_object_section("min"); - f->dump_unsigned("1min", sitem.min[0]); - f->dump_unsigned("5min", sitem.min[1]); - f->dump_unsigned("15min", sitem.min[2]); + f->dump_format_unquoted("1min", "%s", fixed_u_to_string(sitem.min[0],3).c_str()); + f->dump_format_unquoted("5min", "%s", fixed_u_to_string(sitem.min[1],3).c_str()); + f->dump_format_unquoted("15min", "%s", fixed_u_to_string(sitem.min[2],3).c_str()); f->close_section(); // min f->open_object_section("max"); - f->dump_unsigned("1min", sitem.max[0]); - f->dump_unsigned("5min", sitem.max[1]); - f->dump_unsigned("15min", sitem.max[2]); + f->dump_format_unquoted("1min", "%s", fixed_u_to_string(sitem.max[0],3).c_str()); + f->dump_format_unquoted("5min", "%s", fixed_u_to_string(sitem.max[1],3).c_str()); + f->dump_format_unquoted("15min", "%s", fixed_u_to_string(sitem.max[2],3).c_str()); f->close_section(); // max - f->dump_unsigned("last", sitem.last); + f->dump_format_unquoted("last", "%s", fixed_u_to_string(sitem.last,3).c_str()); f->close_section(); // entry } f->close_section(); // entries diff --git a/src/mon/PGMap.cc b/src/mon/PGMap.cc index 7b06d46a3940d..45f741e097931 100644 --- a/src/mon/PGMap.cc +++ b/src/mon/PGMap.cc @@ -2655,7 +2655,7 @@ void PGMap::get_health_checks( << (osdmap.is_down(sback.from) ? " (down)" : "") << " to osd." << sback.to << (osdmap.is_down(sback.to) ? " (down)" : "") - << " " << sback.pingtime << " usec" + << " " << fixed_u_to_string(sback.pingtime, 3) << " msec" << (sback.improving ? " possibly improving" : ""); detail_back.push_back(ss.str()); } @@ -2672,21 +2672,21 @@ void PGMap::get_health_checks( << (osdmap.is_down(sfront.from) ? " (down)" : "") << " to osd." << sfront.to << (osdmap.is_down(sfront.to) ? " (down)" : "") - << " " << sfront.pingtime << " usec" + << " " << fixed_u_to_string(sfront.pingtime, 3) << " msec" << (sfront.improving ? " possibly improving" : ""); detail_front.push_back(ss.str()); } if (detail_back.size() != 0) { ostringstream ss; ss << "Long heartbeat ping times on back interface seen, longest is " - << back_sorted.rbegin()->pingtime << " usec"; + << fixed_u_to_string(back_sorted.rbegin()->pingtime, 3) << " msec"; auto& d = checks->add("OSD_SLOW_PING_TIME_BACK", HEALTH_WARN, ss.str()); d.detail.swap(detail_back); } if (detail_front.size() != 0) { ostringstream ss; ss << "Long heartbeat ping times on front interface seen, longest is " - << front_sorted.rbegin()->pingtime << " usec"; + << fixed_u_to_string(front_sorted.rbegin()->pingtime, 3) << " msec"; auto& d = checks->add("OSD_SLOW_PING_TIME_FRONT", HEALTH_WARN, ss.str()); d.detail.swap(detail_front); } diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 321de0189c606..e7e068474e6d4 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -2400,21 +2400,21 @@ will start to track new ops received afterwards."; f->dump_int("to osd", sitem.to); f->dump_string("interface", (sitem.back ? "back" : "front")); f->open_object_section("average"); - f->dump_int("1min", sitem.times[0]); - f->dump_int("5min", sitem.times[1]); - f->dump_int("15min", sitem.times[2]); + f->dump_format_unquoted("1min", "%s", fixed_u_to_string(sitem.times[0],3).c_str()); + f->dump_format_unquoted("5min", "%s", fixed_u_to_string(sitem.times[1],3).c_str()); + f->dump_format_unquoted("15min", "%s", fixed_u_to_string(sitem.times[2],3).c_str()); f->close_section(); // average f->open_object_section("min"); - f->dump_int("1min", sitem.min[0]); - f->dump_int("5min", sitem.min[1]); - f->dump_int("15min", sitem.min[2]); + f->dump_format_unquoted("1min", "%s", fixed_u_to_string(sitem.max[0],3).c_str()); + f->dump_format_unquoted("5min", "%s", fixed_u_to_string(sitem.max[1],3).c_str()); + f->dump_format_unquoted("15min", "%s", fixed_u_to_string(sitem.max[2],3).c_str()); f->close_section(); // min f->open_object_section("max"); - f->dump_int("1min", sitem.max[0]); - f->dump_int("5min", sitem.max[1]); - f->dump_int("15min", sitem.max[2]); + f->dump_format_unquoted("1min", "%s", fixed_u_to_string(sitem.max[0],3).c_str()); + f->dump_format_unquoted("5min", "%s", fixed_u_to_string(sitem.max[1],3).c_str()); + f->dump_format_unquoted("15min", "%s", fixed_u_to_string(sitem.max[2],3).c_str()); f->close_section(); // max - f->dump_int("last", sitem.last); + f->dump_format_unquoted("last", "%s", fixed_u_to_string(sitem.last,3).c_str()); f->close_section(); // entry } f->close_section(); // entries diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index 06ae7f530ecca..b4fc16023ffeb 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -372,42 +372,42 @@ void osd_stat_t::dump(Formatter *f) const f->open_object_section("interface"); f->dump_string("interface", "back"); f->open_object_section("average"); - f->dump_int("1min", i.second.back_pingtime[0]); - f->dump_int("5min", i.second.back_pingtime[1]); - f->dump_int("15min", i.second.back_pingtime[2]); + f->dump_format_unquoted("1min", "%s", fixed_u_to_string(i.second.back_pingtime[0],3).c_str()); + f->dump_format_unquoted("5min", "%s", fixed_u_to_string(i.second.back_pingtime[1],3).c_str()); + f->dump_format_unquoted("15min", "%s", fixed_u_to_string(i.second.back_pingtime[2],3).c_str()); f->close_section(); // average f->open_object_section("min"); - f->dump_int("1min", i.second.back_min[0]); - f->dump_int("5min", i.second.back_min[1]); - f->dump_int("15min", i.second.back_min[2]); + f->dump_format_unquoted("1min", "%s", fixed_u_to_string(i.second.back_min[0],3).c_str()); + f->dump_format_unquoted("5min", "%s", fixed_u_to_string(i.second.back_min[1],3).c_str()); + f->dump_format_unquoted("15min", "%s", fixed_u_to_string(i.second.back_min[2],3).c_str()); f->close_section(); // min f->open_object_section("max"); - f->dump_int("1min", i.second.back_max[0]); - f->dump_int("5min", i.second.back_max[1]); - f->dump_int("15min", i.second.back_max[2]); + f->dump_format_unquoted("1min", "%s", fixed_u_to_string(i.second.back_max[0],3).c_str()); + f->dump_format_unquoted("5min", "%s", fixed_u_to_string(i.second.back_max[1],3).c_str()); + f->dump_format_unquoted("15min", "%s", fixed_u_to_string(i.second.back_max[2],3).c_str()); f->close_section(); // max - f->dump_int("last", i.second.back_last); + f->dump_format_unquoted("last", "%s", fixed_u_to_string(i.second.back_last,3).c_str()); f->close_section(); // interface if (i.second.front_pingtime[0] != 0) { f->open_object_section("interface"); f->dump_string("interface", "front"); f->open_object_section("average"); - f->dump_int("1min", i.second.front_pingtime[0]); - f->dump_int("5min", i.second.front_pingtime[1]); - f->dump_int("15min", i.second.front_pingtime[2]); + f->dump_format_unquoted("1min", "%s", fixed_u_to_string(i.second.front_pingtime[0],3).c_str()); + f->dump_format_unquoted("5min", "%s", fixed_u_to_string(i.second.front_pingtime[1],3).c_str()); + f->dump_format_unquoted("15min", "%s", fixed_u_to_string(i.second.front_pingtime[2],3).c_str()); f->close_section(); // average f->open_object_section("min"); - f->dump_int("1min", i.second.front_min[0]); - f->dump_int("5min", i.second.front_min[1]); - f->dump_int("15min", i.second.front_min[2]); + f->dump_format_unquoted("1min", "%s", fixed_u_to_string(i.second.front_min[0],3).c_str()); + f->dump_format_unquoted("5min", "%s", fixed_u_to_string(i.second.front_min[1],3).c_str()); + f->dump_format_unquoted("15min", "%s", fixed_u_to_string(i.second.front_min[2],3).c_str()); f->close_section(); // min f->open_object_section("max"); - f->dump_int("1min", i.second.front_max[0]); - f->dump_int("5min", i.second.front_max[1]); - f->dump_int("15min", i.second.front_max[2]); + f->dump_format_unquoted("1min", "%s", fixed_u_to_string(i.second.front_max[0],3).c_str()); + f->dump_format_unquoted("5min", "%s", fixed_u_to_string(i.second.front_max[1],3).c_str()); + f->dump_format_unquoted("15min", "%s", fixed_u_to_string(i.second.front_max[2],3).c_str()); f->close_section(); // max - f->dump_int("last", i.second.front_last); + f->dump_format_unquoted("last", "%s", fixed_u_to_string(i.second.front_last,3).c_str()); f->close_section(); // interface } f->close_section(); // interfaces