Introduce Endpoint#messages_received_per_type

This commit is contained in:
Alexander A. Klimov 2025-04-01 16:45:58 +02:00
parent 3dd7b15808
commit 98d097517b
3 changed files with 19 additions and 0 deletions

View File

@ -149,3 +149,16 @@ double Endpoint::GetBytesReceivedPerSecond() const
{ {
return m_BytesReceived.CalculateRate(Utility::GetTime(), 60); return m_BytesReceived.CalculateRate(Utility::GetTime(), 60);
} }
Dictionary::Ptr Endpoint::GetMessagesReceivedPerType() const
{
DictionaryData result;
for (auto& [afunc, cnt] : m_MessageCounters) {
if (auto v (cnt.load(std::memory_order_relaxed)); v) {
result.emplace_back(afunc->GetName(), v);
}
}
return new Dictionary(std::move(result));
}

View File

@ -56,6 +56,8 @@ public:
double GetBytesSentPerSecond() const override; double GetBytesSentPerSecond() const override;
double GetBytesReceivedPerSecond() const override; double GetBytesReceivedPerSecond() const override;
Dictionary::Ptr GetMessagesReceivedPerType() const override;
protected: protected:
void OnAllConfigLoaded() override; void OnAllConfigLoaded() override;

View File

@ -54,6 +54,10 @@ class Endpoint : ConfigObject
[no_user_modify, no_storage] double bytes_received_per_second { [no_user_modify, no_storage] double bytes_received_per_second {
get; get;
}; };
[no_user_modify, no_storage] Dictionary::Ptr messages_received_per_type {
get;
};
}; };
} }