pub mod call_snapshot;
pub mod moment_stats_item;
pub mod moment_stats_item_set;
pub mod stats_item;
pub mod stats_item_set;
pub mod stats_snapshot;
mod striped_counter;
use std::cell::RefCell;
thread_local! {
static STATS_KEY: RefCell<String> = const { RefCell::new(String::new()) };
}
pub fn with_stats_key<R>(build: impl FnOnce(&mut String), use_key: impl FnOnce(&str) -> R) -> R {
STATS_KEY.with(|buffer| match buffer.try_borrow_mut() {
Ok(mut key) => {
key.clear();
build(&mut key);
use_key(&key)
}
Err(_) => {
let mut key = String::new();
build(&mut key);
use_key(&key)
}
})
}
#[inline]
pub fn push_topic_group_key(key: &mut String, topic: &str, group: &str) {
key.push_str(topic);
key.push('@');
key.push_str(group);
}
pub struct Stats;
impl Stats {
pub const BROKER_GET_FROM_DISK_NUMS: &'static str = "BROKER_GET_FROM_DISK_NUMS";
pub const BROKER_GET_FROM_DISK_SIZE: &'static str = "BROKER_GET_FROM_DISK_SIZE";
pub const BROKER_GET_NUMS: &'static str = "BROKER_GET_NUMS";
pub const BROKER_PUT_NUMS: &'static str = "BROKER_PUT_NUMS";
pub const COMMERCIAL_PERM_FAILURES: &'static str = "COMMERCIAL_PERM_FAILURES";
pub const COMMERCIAL_RCV_EPOLLS: &'static str = "COMMERCIAL_RCV_EPOLLS";
pub const COMMERCIAL_RCV_SIZE: &'static str = "COMMERCIAL_RCV_SIZE";
pub const COMMERCIAL_RCV_TIMES: &'static str = "COMMERCIAL_RCV_TIMES";
pub const COMMERCIAL_SEND_SIZE: &'static str = "COMMERCIAL_SEND_SIZE";
pub const COMMERCIAL_SEND_TIMES: &'static str = "COMMERCIAL_SEND_TIMES";
pub const COMMERCIAL_SNDBCK_TIMES: &'static str = "COMMERCIAL_SNDBCK_TIMES";
pub const GROUP_GET_FALL_SIZE: &'static str = "GROUP_GET_FALL_SIZE";
pub const GROUP_GET_FALL_TIME: &'static str = "GROUP_GET_FALL_TIME";
pub const GROUP_GET_FROM_DISK_NUMS: &'static str = "GROUP_GET_FROM_DISK_NUMS";
pub const GROUP_GET_FROM_DISK_SIZE: &'static str = "GROUP_GET_FROM_DISK_SIZE";
pub const GROUP_GET_LATENCY: &'static str = "GROUP_GET_LATENCY";
pub const GROUP_GET_NUMS: &'static str = "GROUP_GET_NUMS";
pub const GROUP_GET_SIZE: &'static str = "GROUP_GET_SIZE";
pub const QUEUE_GET_NUMS: &'static str = "QUEUE_GET_NUMS";
pub const QUEUE_GET_SIZE: &'static str = "QUEUE_GET_SIZE";
pub const QUEUE_PUT_NUMS: &'static str = "QUEUE_PUT_NUMS";
pub const QUEUE_PUT_SIZE: &'static str = "QUEUE_PUT_SIZE";
pub const SNDBCK_PUT_NUMS: &'static str = "SNDBCK_PUT_NUMS";
pub const TOPIC_PUT_NUMS: &'static str = "TOPIC_PUT_NUMS";
pub const TOPIC_PUT_SIZE: &'static str = "TOPIC_PUT_SIZE";
}