use once_cell::sync::Lazy;
use tari_metrics::{IntCounter, IntGauge};
pub fn num_sessions() -> IntGauge {
static METER: Lazy<IntGauge> = Lazy::new(|| {
tari_metrics::register_int_gauge(
"comms::messaging::num_sessions",
"The number of active messaging sessions",
)
.unwrap()
});
METER.clone()
}
pub fn outbound_message_count() -> IntCounter {
static METER: Lazy<IntCounter> = Lazy::new(|| {
tari_metrics::register_int_counter(
"comms::messaging::outbound_message_count",
"The number of handshakes per peer",
)
.unwrap()
});
METER.clone()
}
pub fn inbound_message_count() -> IntCounter {
static METER: Lazy<IntCounter> = Lazy::new(|| {
tari_metrics::register_int_counter(
"comms::messaging::inbound_message_count",
"The number of handshakes per peer",
)
.unwrap()
});
METER.clone()
}
pub fn error_count() -> IntCounter {
static METER: Lazy<IntCounter> =
Lazy::new(|| tari_metrics::register_int_counter("comms::messaging::errors", "The number of errors").unwrap());
METER.clone()
}