fix: Count cluster messages as cluster traffic (#8308)

This commit is contained in:
Bart
2026-09-29 12:30:58 +00:00
committed by GitHub
parent 97cddd6721
commit 768aef30dc
2 changed files with 11 additions and 0 deletions

View File

@@ -25,6 +25,16 @@ public:
auto const known = TrafficCount::categorize(message, protocol::mtPING, false);
BEAST_EXPECT(known == TrafficCount::Category::Base);
// cluster messages have a category of their own, in both directions; the same lookup
// serves outbound traffic, so a missing entry would hide them from a node's report
// whichever way they traveled
BEAST_EXPECT(
TrafficCount::categorize(message, protocol::mtCLUSTER, true) ==
TrafficCount::Category::Cluster);
BEAST_EXPECT(
TrafficCount::categorize(message, protocol::mtCLUSTER, false) ==
TrafficCount::Category::Cluster);
// an unknown message type is categorized as unknown
auto const unknown =
TrafficCount::categorize(message, static_cast<protocol::MessageType>(99), false);

View File

@@ -11,6 +11,7 @@ namespace xrpl {
std::unordered_map<protocol::MessageType, TrafficCount::Category> const kTypeLookup = {
{protocol::mtPING, TrafficCount::Category::Base},
{protocol::mtSTATUS_CHANGE, TrafficCount::Category::Base},
{protocol::mtCLUSTER, TrafficCount::Category::Cluster},
{protocol::mtMANIFESTS, TrafficCount::Category::Manifests},
{protocol::mtENDPOINTS, TrafficCount::Category::Overlay},
{protocol::mtTRANSACTION, TrafficCount::Category::Transaction},