mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Make protocol message counters more granular:
A running instance of the server tracks the number of protocol messages and the number of bytes it sends and receives. This commit makes the counters more granular, allowing server operators to better track and understand bandwidth usage.
This commit is contained in:
committed by
Manoj doshi
parent
2c4b3d515d
commit
ba2714fa22
@@ -593,26 +593,18 @@ void
|
||||
OverlayImpl::onWrite (beast::PropertyStream::Map& stream)
|
||||
{
|
||||
beast::PropertyStream::Set set ("traffic", stream);
|
||||
auto stats = m_traffic.getCounts();
|
||||
for (auto& i : stats)
|
||||
auto const stats = m_traffic.getCounts();
|
||||
for (auto const& i : stats)
|
||||
{
|
||||
if (! i.second.messagesIn && ! i.second.messagesOut)
|
||||
continue;
|
||||
|
||||
beast::PropertyStream::Map item (set);
|
||||
item["category"] = i.first;
|
||||
item["bytes_in"] =
|
||||
beast::lexicalCast<std::string>
|
||||
(i.second.bytesIn.load());
|
||||
item["messages_in"] =
|
||||
beast::lexicalCast<std::string>
|
||||
(i.second.messagesIn.load());
|
||||
item["bytes_out"] =
|
||||
beast::lexicalCast<std::string>
|
||||
(i.second.bytesOut.load());
|
||||
item["messages_out"] =
|
||||
beast::lexicalCast<std::string>
|
||||
(i.second.messagesOut.load());
|
||||
if (i)
|
||||
{
|
||||
beast::PropertyStream::Map item(set);
|
||||
item["category"] = i.name;
|
||||
item["bytes_in"] = std::to_string(i.bytesIn.load());
|
||||
item["messages_in"] = std::to_string(i.messagesIn.load());
|
||||
item["bytes_out"] = std::to_string(i.bytesOut.load());
|
||||
item["messages_out"] = std::to_string(i.messagesOut.load());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user