Skip to content
Snippets Groups Projects
Commit 866f09e9 authored by Levente Pap's avatar Levente Pap
Browse files

New metric MessageRequestQueueSize

parent d5cb2150
No related branches found
No related tags found
No related merge requests found
...@@ -26,6 +26,9 @@ var ( ...@@ -26,6 +26,9 @@ var (
// protect map from concurrent read/write. // protect map from concurrent read/write.
messageCountPerPayloadMutex syncutils.RWMutex messageCountPerPayloadMutex syncutils.RWMutex
// number of messages being requested by the message layer.
requestQueueSize atomic.Int64
) )
////// Exported functions to obtain metrics from outside ////// ////// Exported functions to obtain metrics from outside //////
...@@ -54,6 +57,11 @@ func MessageTips() uint64 { ...@@ -54,6 +57,11 @@ func MessageTips() uint64 {
return messageTips.Load() return messageTips.Load()
} }
// MessageRequestQueueSize returns the number of message requests the node currently has registered.
func MessageRequestQueueSize() int64 {
return requestQueueSize.Load()
}
////// Handling data updates and measuring ////// ////// Handling data updates and measuring //////
func increasePerPayloadCounter(p payload.Type) { func increasePerPayloadCounter(p payload.Type) {
...@@ -93,3 +101,8 @@ func measureReceivedMPS() { ...@@ -93,3 +101,8 @@ func measureReceivedMPS() {
// trigger events for outside listeners // trigger events for outside listeners
Events.ReceivedMPSUpdated.Trigger(sampledMPS) Events.ReceivedMPSUpdated.Trigger(sampledMPS)
} }
func measureRequestQueueSize() {
size := int64(messagelayer.MessageRequester().RequestQueueSize())
requestQueueSize.Store(size)
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment