-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(papyrus_network): add broadcast and sqmr metrics structs (#4046)
* feat(papyrus_network): add broadcast and sqmr metrics structs * feat(papyrus_network): track broadcast metrics * refactor(papyrus_network): fix CR comments * fix(starknet_consensus_manager): fix dependency on state_sync_types
- Loading branch information
1 parent
c7124b0
commit 9ec2637
Showing
7 changed files
with
102 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,47 @@ | ||
use starknet_sequencer_metrics::metrics::MetricGauge; | ||
pub struct NetworkMetrics { | ||
pub num_connected_peers: MetricGauge, | ||
use starknet_sequencer_metrics::metrics::{MetricCounter, MetricGauge}; | ||
|
||
// TODO(alonl): consider splitting the metrics by topic | ||
pub struct BroadcastNetworkMetrics { | ||
pub num_sent_broadcast_messages: MetricCounter, | ||
pub num_received_broadcast_messages: MetricCounter, | ||
} | ||
|
||
impl BroadcastNetworkMetrics { | ||
pub fn register(&self) { | ||
self.num_sent_broadcast_messages.register(); | ||
self.num_received_broadcast_messages.register(); | ||
} | ||
} | ||
|
||
pub struct SqmrNetworkMetrics { | ||
pub num_active_inbound_sessions: MetricGauge, | ||
pub num_active_outbound_sessions: MetricGauge, | ||
} | ||
|
||
impl NetworkMetrics { | ||
impl SqmrNetworkMetrics { | ||
pub fn register(&self) { | ||
let num_connected_peers_metric = self.num_connected_peers.register(); | ||
num_connected_peers_metric.set(0f64); | ||
let num_active_inbound_sessions_metric = self.num_active_inbound_sessions.register(); | ||
num_active_inbound_sessions_metric.set(0f64); | ||
let num_active_outbound_sessions_metric = self.num_active_outbound_sessions.register(); | ||
num_active_outbound_sessions_metric.set(0f64); | ||
} | ||
} | ||
|
||
pub struct NetworkMetrics { | ||
pub num_connected_peers: MetricGauge, | ||
pub broadcast_metrics: Option<BroadcastNetworkMetrics>, | ||
pub sqmr_metrics: Option<SqmrNetworkMetrics>, | ||
} | ||
|
||
impl NetworkMetrics { | ||
pub fn register(&self) { | ||
let num_connected_peers_metric = self.num_connected_peers.register(); | ||
num_connected_peers_metric.set(0f64); | ||
if let Some(broadcast_metrics) = self.broadcast_metrics.as_ref() { | ||
broadcast_metrics.register(); | ||
} | ||
if let Some(sqmr_metrics) = self.sqmr_metrics.as_ref() { | ||
sqmr_metrics.register(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters