Decorate mpsc-notification-to-protocol with the protocol name (#3873)

Currently, all protocols use the same metric name for
`mpsc-notification-to-protocol` this is bad because we can't actually
tell which protocol might cause problems.

This patch proposes we derive the name of the metric from the protocol
name, so that we have separate metrics for each protocol and properly
detect which one is having problem processing its messages.

---------

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>
This commit is contained in:
Alexandru Gheorghe
2024-03-29 13:24:26 +02:00
committed by GitHub
parent b310b575cd
commit 5638d1a830
2 changed files with 22 additions and 3 deletions
+6 -1
View File
@@ -86,7 +86,7 @@ pub fn tracing_unbounded<T>(
warning_fired: Arc::new(AtomicBool::new(false)),
creation_backtrace: Arc::new(Backtrace::force_capture()),
};
let receiver = TracingUnboundedReceiver { inner: r, name };
let receiver = TracingUnboundedReceiver { inner: r, name: name.into() };
(sender, receiver)
}
@@ -157,6 +157,11 @@ impl<T> TracingUnboundedReceiver<T> {
pub fn len(&self) -> usize {
self.inner.len()
}
/// The name of this receiver
pub fn name(&self) -> &'static str {
self.name
}
}
impl<T> Drop for TracingUnboundedReceiver<T> {