Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(nodestats): add counters to monitor failed data requests #2218

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions data_structures/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3195,8 +3195,12 @@ pub struct NodeStats {
pub block_proposed_count: u32,
/// Number of blocks included in the block chain
pub block_mined_count: u32,
/// Number of times we could not solve a data request because the collateral requirement was too high
pub dr_insufficient_collateral_count: u32,
/// Number of times we were eligible to participate in a Data Request
pub dr_eligibility_count: u32,
/// Number of times we were eligible to participate in a Data Request but all our collateral was locked
pub dr_all_collateral_locked_count: u32,
/// Number of proposed commits
pub commits_proposed_count: u32,
/// Number of commits included in a data request
Expand Down
2 changes: 2 additions & 0 deletions node/src/actors/chain_manager/mining.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ impl ChainManager {
block_number_limit,
) {
log::debug!("Mining data request: Insufficient collateral, the data request need {} mature wits", Wit::from_nanowits(collateral_amount));
self.chain_state.node_stats.dr_insufficient_collateral_count += 1;
continue;
}

Expand Down Expand Up @@ -520,6 +521,7 @@ impl ChainManager {
available_balance,
required_collateral,
);
act.chain_state.node_stats.dr_all_collateral_locked_count += 1;
// Decrease the retrieval limit hoping that some other, cheaper,
// data request can be resolved instead
cloned_retrieval_count2.fetch_sub(added_retrieval_count, atomic::Ordering::Relaxed);
Expand Down
4 changes: 4 additions & 0 deletions src/cli/node/json_rpc_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1212,13 +1212,17 @@ pub fn get_node_stats(addr: SocketAddr) -> Result<(), failure::Error> {
- Proposed blocks: {}\n\
- Blocks included in the block chain: {}\n\
Data Request mining stats:\n\
- Times with insuffiencent collateral to mine a data request: {}\n\
- Times with eligibility to mine a data request: {}\n\
- Times with no available collateral to mine a data request: {}\n\
- Proposed commits: {}\n\
- Accepted commits: {}\n\
- Slashed commits: {}",
node_stats.block_proposed_count,
node_stats.block_mined_count,
node_stats.dr_insufficient_collateral_count,
node_stats.dr_eligibility_count,
node_stats.dr_all_collateral_locked_count,
node_stats.commits_proposed_count,
node_stats.commits_count,
node_stats.slashed_count
Expand Down