Skip to content

Commit

Permalink
Add pull request failure to stats (#1955)
Browse files Browse the repository at this point in the history
  • Loading branch information
wezrule committed May 6, 2019
1 parent 74843b8 commit b2e33bc
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
7 changes: 7 additions & 0 deletions nano/node/bootstrap.cpp
Expand Up @@ -459,6 +459,7 @@ void nano::bulk_pull_client::request ()
{
this_l->connection->node->logger.try_log (boost::str (boost::format ("Error sending bulk pull request to %1%: to %2%") % ec.message () % this_l->connection->channel->to_string ()));
}
this_l->connection->node->stats.inc (nano::stat::type::bootstrap, nano::stat::detail::bulk_pull_request_failure, nano::stat::dir::in);
}
});
}
Expand All @@ -477,6 +478,7 @@ void nano::bulk_pull_client::receive_block ()
{
this_l->connection->node->logger.try_log (boost::str (boost::format ("Error receiving block type: %1%") % ec.message ()));
}
this_l->connection->node->stats.inc (nano::stat::type::bootstrap, nano::stat::detail::bulk_pull_receive_block_failure, nano::stat::dir::in);
}
});
}
Expand Down Expand Up @@ -605,6 +607,7 @@ void nano::bulk_pull_client::received_block (boost::system::error_code const & e
{
connection->node->logger.try_log ("Error deserializing block received from pull request");
}
connection->node->stats.inc (nano::stat::type::bootstrap, nano::stat::detail::bulk_pull_deserialize_receive_block, nano::stat::dir::in);
}
}
else
Expand All @@ -613,6 +616,7 @@ void nano::bulk_pull_client::received_block (boost::system::error_code const & e
{
connection->node->logger.try_log (boost::str (boost::format ("Error bulk receiving block: %1%") % ec.message ()));
}
connection->node->stats.inc (nano::stat::type::bootstrap, nano::stat::detail::bulk_pull_receive_block_failure, nano::stat::dir::in);
}
}

Expand Down Expand Up @@ -777,6 +781,7 @@ void nano::bulk_pull_account_client::request ()
{
this_l->connection->node->logger.try_log (boost::str (boost::format ("Error starting bulk pull request to %1%: to %2%") % ec.message () % this_l->connection->channel->to_string ()));
}
this_l->connection->node->stats.inc (nano::stat::type::bootstrap, nano::stat::detail::bulk_pull_error_starting_request, nano::stat::dir::in);
}
});
}
Expand Down Expand Up @@ -1348,6 +1353,8 @@ void nano::bootstrap_attempt::requeue_pull (nano::pull_info const & pull_a)
{
node->logger.try_log (boost::str (boost::format ("Failed to pull account %1% down to %2% after %3% attempts and %4% blocks processed") % pull.account.to_account () % pull.end.to_string () % pull.attempts % pull.processed));
}
node->stats.inc (nano::stat::type::bootstrap, nano::stat::detail::bulk_pull_failed_account, nano::stat::dir::in);

node->bootstrap_initiator.cache.add (pull);
}
}
Expand Down
15 changes: 15 additions & 0 deletions nano/node/stats.cpp
Expand Up @@ -388,6 +388,21 @@ std::string nano::stat::detail_to_string (uint32_t key)
case nano::stat::detail::bulk_pull_account:
res = "bulk_pull_account";
break;
case nano::stat::detail::bulk_pull_deserialize_receive_block:
res = "bulk_pull_deserialize_receive_block";
break;
case nano::stat::detail::bulk_pull_error_starting_request:
res = "bulk_pull_error_starting_request";
break;
case nano::stat::detail::bulk_pull_failed_account:
res = "bulk_pull_failed_account";
break;
case nano::stat::detail::bulk_pull_receive_block_failure:
res = "bulk_pull_receive_block_failure";
break;
case nano::stat::detail::bulk_pull_request_failure:
res = "bulk_pull_request_failure";
break;
case nano::stat::detail::bulk_push:
res = "bulk_push";
break;
Expand Down
7 changes: 6 additions & 1 deletion nano/node/stats.hpp
Expand Up @@ -267,8 +267,13 @@ class stat final

// bootstrap specific
bulk_pull,
bulk_push,
bulk_pull_account,
bulk_pull_deserialize_receive_block,
bulk_pull_error_starting_request,
bulk_pull_failed_account,
bulk_pull_receive_block_failure,
bulk_pull_request_failure,
bulk_push,
frontier_req,
error_socket_close,

Expand Down

0 comments on commit b2e33bc

Please sign in to comment.