@@ -131,6 +131,8 @@ pub(crate) struct Metrics {
131131 publish_messages_dropped : Family < TopicHash , Counter > ,
132132 /// The number of forward messages dropped by the sender.
133133 forward_messages_dropped : Family < TopicHash , Counter > ,
134+ /// The number of messages that timed out and could not be sent.
135+ timedout_messages_dropped : Family < TopicHash , Counter > ,
134136
135137 /* Metrics regarding mesh state */
136138 /// Number of peers in our mesh. This metric should be updated with the count of peers for a
@@ -241,6 +243,11 @@ impl Metrics {
241243 "Number of forward messages dropped per topic"
242244 ) ;
243245
246+ let timeout_messages_dropped = register_family ! (
247+ "timeout_messages_dropped_per_topic" ,
248+ "Number of timedout messages dropped per topic"
249+ ) ;
250+
244251 let mesh_peer_counts = register_family ! (
245252 "mesh_peer_counts" ,
246253 "Number of peers in each topic in our mesh"
@@ -347,6 +354,7 @@ impl Metrics {
347354 rejected_messages,
348355 publish_messages_dropped,
349356 forward_messages_dropped,
357+ timedout_messages_dropped : timeout_messages_dropped,
350358 mesh_peer_counts,
351359 mesh_peer_inclusion_events,
352360 mesh_peer_churn_events,
@@ -508,6 +516,13 @@ impl Metrics {
508516 }
509517 }
510518
519+ /// Register dropping a message that timedout over a topic.
520+ pub ( crate ) fn timeout_msg_dropped ( & mut self , topic : & TopicHash ) {
521+ if self . register_topic ( topic) . is_ok ( ) {
522+ self . timedout_messages_dropped . get_or_create ( topic) . inc ( ) ;
523+ }
524+ }
525+
511526 /// Register that a message was received (and was not a duplicate).
512527 pub ( crate ) fn msg_recvd ( & mut self , topic : & TopicHash ) {
513528 if self . register_topic ( topic) . is_ok ( ) {
0 commit comments