Add callback stats (#1071)

This commit is contained in:
cryptocode 2018-08-24 22:38:59 +02:00 committed by Roy Keene
commit fae91bd77c
3 changed files with 18 additions and 2 deletions

View file

@ -1747,6 +1747,7 @@ stats (config.stat_config)
{
if (resp->result () == boost::beast::http::status::ok)
{
node_l->stats.inc (rai::stat::type::http_callback, rai::stat::detail::initiate, rai::stat::dir::out);
}
else
{
@ -1754,6 +1755,7 @@ stats (config.stat_config)
{
BOOST_LOG (node_l->log) << boost::str (boost::format ("Callback to %1%:%2% failed with status: %3%") % address % port % resp->result ());
}
node_l->stats.inc (rai::stat::type::error, rai::stat::detail::http_callback, rai::stat::dir::out);
}
}
else
@ -1762,6 +1764,7 @@ stats (config.stat_config)
{
BOOST_LOG (node_l->log) << boost::str (boost::format ("Unable complete callback: %1%:%2%: %3%") % address % port % ec.message ());
}
node_l->stats.inc (rai::stat::type::error, rai::stat::detail::http_callback, rai::stat::dir::out);
};
});
}
@ -1771,6 +1774,7 @@ stats (config.stat_config)
{
BOOST_LOG (node_l->log) << boost::str (boost::format ("Unable to send callback: %1%:%2%: %3%") % address % port % ec.message ());
}
node_l->stats.inc (rai::stat::type::error, rai::stat::detail::http_callback, rai::stat::dir::out);
}
});
}
@ -1780,6 +1784,7 @@ stats (config.stat_config)
{
BOOST_LOG (node_l->log) << boost::str (boost::format ("Unable to connect to callback address: %1%:%2%: %3%") % address % port % ec.message ());
}
node_l->stats.inc (rai::stat::type::error, rai::stat::detail::http_callback, rai::stat::dir::out);
}
});
}
@ -1790,6 +1795,7 @@ stats (config.stat_config)
{
BOOST_LOG (node_l->log) << boost::str (boost::format ("Error resolving callback: %1%:%2%: %3%") % address % port % ec.message ());
}
node_l->stats.inc (rai::stat::type::error, rai::stat::detail::http_callback, rai::stat::dir::out);
}
});
}

View file

@ -324,6 +324,9 @@ std::string rai::stat::type_to_string (uint32_t key)
case rai::stat::type::error:
res = "error";
break;
case rai::stat::type::http_callback:
res = "http_callback";
break;
case rai::stat::type::ledger:
res = "ledger";
break;
@ -388,6 +391,9 @@ std::string rai::stat::detail_to_string (uint32_t key)
case rai::stat::detail::handshake:
res = "handshake";
break;
case rai::stat::detail::http_callback:
res = "http_callback";
break;
case rai::stat::detail::initiate:
res = "initiate";
break;

View file

@ -183,7 +183,8 @@ public:
rollback,
bootstrap,
vote,
peering
http_callback,
peering,
};
/** Optional detail type */
@ -194,6 +195,7 @@ public:
// error specific
bad_sender,
insufficient_work,
http_callback,
// ledger, block, bootstrap
send,
@ -211,8 +213,10 @@ public:
confirm_ack,
node_id_handshake,
// bootstrap specific
// bootstrap, callback
initiate,
// bootstrap specific
bulk_pull,
bulk_push,
bulk_pull_account,