Skip to content

Commit

Permalink
src: hub: Add hub messages stats to the protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
joaoantoniocardoso committed Sep 16, 2024
1 parent 607a3ac commit 679a629
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/hub/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ impl HubActor {
let hub_stats = self.get_hub_stats().await;
let _ = response.send(hub_stats);
}
HubCommand::GetHubMessagesStats { response } => {
let hub_messages_stats = self.get_hub_messages_stats().await;
let _ = response.send(hub_messages_stats);
}
HubCommand::ResetAllStats { response } => {
let _ = response.send(self.reset_all_stats().await);
}
Expand Down
8 changes: 7 additions & 1 deletion src/hub/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ use tokio::sync::{broadcast, oneshot};
use crate::{
drivers::{Driver, DriverInfo},
protocol::Protocol,
stats::driver::{AccumulatedDriverStats, AccumulatedStatsInner},
stats::{
driver::{AccumulatedDriverStats, AccumulatedStatsInner},
messages::AccumulatedHubMessagesStats,
},
};

pub enum HubCommand {
Expand All @@ -27,6 +30,9 @@ pub enum HubCommand {
GetHubStats {
response: oneshot::Sender<AccumulatedStatsInner>,
},
GetHubMessagesStats {
response: oneshot::Sender<AccumulatedHubMessagesStats>,
},
GetDriversStats {
response: oneshot::Sender<Vec<(String, AccumulatedDriverStats)>>,
},
Expand Down

0 comments on commit 679a629

Please sign in to comment.