add stats metrics (#1207)

support new cli command `easytier-cli stats`

It's useful to find out which components are consuming bandwidth.
This commit is contained in:
Sijie.Sun
2025-08-09 00:06:35 +08:00
committed by GitHub
parent efa17a7c10
commit 8cdb27d43d
15 changed files with 1442 additions and 19 deletions
@@ -78,6 +78,14 @@ impl ServiceRegistry {
self.table.insert(key, entry);
}
pub fn get_method_name(&self, rpc_desc: &RpcDescriptor) -> Option<String> {
let service_key = ServiceKey::from(rpc_desc);
let entry = self.table.get(&service_key)?;
let method_index = rpc_desc.method_index as u8;
let method_name = entry.service.get_method_name(method_index).ok()?;
Some(method_name)
}
pub fn unregister<H: Handler<Controller = RpcController>>(
&self,
h: H,