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

Add callback stats #1071

Merged
merged 1 commit into from
Aug 24, 2018
Merged
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
6 changes: 6 additions & 0 deletions rai/node/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1755,13 +1755,15 @@ 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
{
if (node_l->config.logging.callback_logging ())
{
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
Expand All @@ -1770,6 +1772,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);
};
});
}
Expand All @@ -1779,6 +1782,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);
}
});
}
Expand All @@ -1788,6 +1792,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);
}
});
}
Expand All @@ -1798,6 +1803,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);
}
});
}
Expand Down
6 changes: 6 additions & 0 deletions rai/node/stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,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;
Expand Down Expand Up @@ -389,6 +392,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;
Expand Down
8 changes: 6 additions & 2 deletions rai/node/stats.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ class stat
rollback,
bootstrap,
vote,
peering
http_callback,
peering,
};

/** Optional detail type */
Expand All @@ -195,6 +196,7 @@ class stat
// error specific
bad_sender,
insufficient_work,
http_callback,

// ledger, block, bootstrap
send,
Expand All @@ -212,8 +214,10 @@ class stat
confirm_ack,
node_id_handshake,

// bootstrap specific
// bootstrap, callback
initiate,

// bootstrap specific
bulk_pull,
bulk_push,
bulk_pull_account,
Expand Down