Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Add node authority status metric #4699

Merged
merged 21 commits into from
Jan 13, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions node/network/gossip-support/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ struct MetricsInner {
}

impl Metrics {
#[cfg(test)]
/// Dummy constructor for testing.
sandreim marked this conversation as resolved.
Show resolved Hide resolved
pub fn new_dummy() -> Self {
Self(None)
}

/// Set the authority flag.
pub fn on_is_authority(&self) {
ordian marked this conversation as resolved.
Show resolved Hide resolved
if let Some(metrics) = &self.0 {
Expand Down
6 changes: 5 additions & 1 deletion node/network/gossip-support/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,11 @@ async fn get_other_authorities_addrs_map() -> HashMap<AuthorityDiscoveryId, Hash
}

fn make_subsystem() -> GossipSupport<MockAuthorityDiscovery> {
GossipSupport::new(make_ferdie_keystore(), MOCK_AUTHORITY_DISCOVERY.clone())
GossipSupport::new(
make_ferdie_keystore(),
MOCK_AUTHORITY_DISCOVERY.clone(),
Metrics::new_dummy(),
)
}

fn test_harness<T: Future<Output = VirtualOverseer>, AD: AuthorityDiscovery>(
Expand Down