mirror of
https://github.com/Icinga/icinga2.git
synced 2025-09-25 18:48:50 +02:00
Measure and store message processing time per endpoint
Co-authored-by: Alexander A. Klimov <alexander.klimov@icinga.com>
This commit is contained in:
parent
4b2b45c8a1
commit
e3ee07b5a0
@ -130,6 +130,11 @@ void Endpoint::AddMessageReceived(const intrusive_ptr<ApiFunction>& method)
|
||||
m_MessageCounters.at(method).fetch_add(1, std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
void Endpoint::AddMessageProcessed(const AtomicDuration::Clock::duration& duration)
|
||||
{
|
||||
m_InputProcessingTime += duration;
|
||||
}
|
||||
|
||||
double Endpoint::GetMessagesSentPerSecond() const
|
||||
{
|
||||
return m_MessagesSent.CalculateRate(Utility::GetTime(), 60);
|
||||
|
@ -49,6 +49,7 @@ public:
|
||||
void AddMessageSent(int bytes);
|
||||
void AddMessageReceived(int bytes);
|
||||
void AddMessageReceived(const intrusive_ptr<ApiFunction>& method);
|
||||
void AddMessageProcessed(const AtomicDuration::Clock::duration& duration);
|
||||
|
||||
double GetMessagesSentPerSecond() const override;
|
||||
double GetMessagesReceivedPerSecond() const override;
|
||||
@ -71,6 +72,8 @@ private:
|
||||
mutable RingBuffer m_MessagesReceived{60};
|
||||
mutable RingBuffer m_BytesSent{60};
|
||||
mutable RingBuffer m_BytesReceived{60};
|
||||
|
||||
AtomicDuration m_InputProcessingTime;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -106,6 +106,9 @@ void JsonRpcConnection::HandleIncomingMessages(boost::asio::yield_context yc)
|
||||
l_TaskStats.InsertValue(Utility::GetTime(), 1);
|
||||
|
||||
auto total = ch::steady_clock::now() - start;
|
||||
if (m_Endpoint) {
|
||||
m_Endpoint->AddMessageProcessed(total);
|
||||
}
|
||||
|
||||
Log msg(total >= ch::seconds(5) ? LogWarning : LogDebug, "JsonRpcConnection");
|
||||
msg << "Processed JSON-RPC '" << rpcMethod << "' message for identity '" << m_Identity
|
||||
|
Loading…
x
Reference in New Issue
Block a user