Skip to content

Commit

Permalink
GH-226 Add producer, timestamp, and latency to missing vote log output
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Jul 25, 2024
1 parent c3fda08 commit a3955ce
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions plugins/producer_plugin/producer_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,8 @@ class producer_plugin_impl : public std::enable_shared_from_this<producer_plugin
void log_missing_votes(const signed_block_ptr& block, const block_id_type& id,
const qc_vote_metrics_t::fin_auth_set_t& missing_votes) {
if (vote_logger.is_enabled(fc::log_level::info)) {
if (fc::time_point::now() - block->timestamp < fc::minutes(5) || (block->block_num() % 1000 == 0)) {
auto now = fc::time_point::now();
if (now - block->timestamp < fc::minutes(5) || (block->block_num() % 1000 == 0)) {
std::string not_voted;
for (const auto& f : missing_votes) {
if (_finalizers.contains(f->public_key)) {
Expand All @@ -643,8 +644,9 @@ class producer_plugin_impl : public std::enable_shared_from_this<producer_plugin
}
if (!not_voted.empty()) {
not_voted.resize(not_voted.size() - 1); // remove ','
fc_ilog(vote_logger, "Block ${n}:${id} has no votes from finalizers: ${v}",
("n", block->block_num())("id", id.str().substr(8,16))("v", not_voted));
fc_ilog(vote_logger, "Block ${id}... #${n} @ ${t} produced by ${p}, latency: ${l}ms has no votes from finalizers: ${v}",
("id", id.str().substr(8, 16))("n", block->block_num())("t", block->timestamp)("p", block->producer)
("l", (now - block->timestamp).count() / 1000)("v", not_voted));
}
}
}
Expand Down

0 comments on commit a3955ce

Please sign in to comment.