mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-09-02 17:15:43 +00:00
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:
@@ -4,7 +4,7 @@ use futures::{SinkExt as _, StreamExt};
|
||||
use tokio::task::JoinSet;
|
||||
|
||||
use crate::{
|
||||
common::{error::Error, PeerId},
|
||||
common::{error::Error, PeerId, stats_manager::StatsManager},
|
||||
proto::rpc_impl::{self, bidirect::BidirectRpcManager},
|
||||
tunnel::packet_def::ZCPacket,
|
||||
};
|
||||
@@ -47,6 +47,15 @@ impl PeerRpcManager {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn new_with_stats_manager(tspt: impl PeerRpcManagerTransport, stats_manager: Arc<StatsManager>) -> Self {
|
||||
Self {
|
||||
tspt: Arc::new(Box::new(tspt)),
|
||||
bidirect_rpc: BidirectRpcManager::new_with_stats_manager(stats_manager),
|
||||
|
||||
tasks: Mutex::new(JoinSet::new()),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn run(&self) {
|
||||
let ret = self.bidirect_rpc.run_and_create_tunnel();
|
||||
let (mut rx, mut tx) = ret.split();
|
||||
|
||||
Reference in New Issue
Block a user