5
5
6
6
#include " remote/i2-remote.hpp"
7
7
#include " remote/endpoint-ti.hpp"
8
+ #include " base/atomic.hpp"
8
9
#include " base/ringbuffer.hpp"
10
+ #include < cstdint>
9
11
#include < set>
12
+ #include < unordered_map>
10
13
11
14
namespace icinga
12
15
{
13
16
17
+ class ApiFunction ;
14
18
class JsonRpcConnection ;
15
19
class Zone ;
16
20
@@ -28,6 +32,8 @@ class Endpoint final : public ObjectImpl<Endpoint>
28
32
static boost::signals2::signal<void (const Endpoint::Ptr&, const intrusive_ptr<JsonRpcConnection>&)> OnConnected;
29
33
static boost::signals2::signal<void (const Endpoint::Ptr&, const intrusive_ptr<JsonRpcConnection>&)> OnDisconnected;
30
34
35
+ Endpoint ();
36
+
31
37
void AddClient (const intrusive_ptr<JsonRpcConnection>& client);
32
38
void RemoveClient (const intrusive_ptr<JsonRpcConnection>& client);
33
39
std::set<intrusive_ptr<JsonRpcConnection> > GetClients () const ;
@@ -42,20 +48,24 @@ class Endpoint final : public ObjectImpl<Endpoint>
42
48
43
49
void AddMessageSent (int bytes);
44
50
void AddMessageReceived (int bytes);
51
+ void AddMessageReceived (const intrusive_ptr<ApiFunction>& method);
45
52
46
53
double GetMessagesSentPerSecond () const override ;
47
54
double GetMessagesReceivedPerSecond () const override ;
48
55
49
56
double GetBytesSentPerSecond () const override ;
50
57
double GetBytesReceivedPerSecond () const override ;
51
58
59
+ Dictionary::Ptr GetMessagesReceivedPerType () const override ;
60
+
52
61
protected:
53
62
void OnAllConfigLoaded () override ;
54
63
55
64
private:
56
65
mutable std::mutex m_ClientsLock;
57
66
std::set<intrusive_ptr<JsonRpcConnection> > m_Clients;
58
67
intrusive_ptr<Zone> m_Zone;
68
+ std::unordered_map<intrusive_ptr<ApiFunction>, Atomic<uint_fast64_t >> m_MessageCounters;
59
69
60
70
mutable RingBuffer m_MessagesSent{60 };
61
71
mutable RingBuffer m_MessagesReceived{60 };
0 commit comments