mirror of
https://github.com/XRPLF/clio.git
synced 2025-12-06 17:27:58 +00:00
@@ -23,13 +23,22 @@
|
||||
|
||||
namespace RPC {
|
||||
|
||||
void
|
||||
Counters::rpcFailed(std::string const& method)
|
||||
{
|
||||
std::scoped_lock lk(mutex_);
|
||||
MethodInfo& counters = methodInfo_[method];
|
||||
++counters.started;
|
||||
++counters.failed;
|
||||
}
|
||||
|
||||
void
|
||||
Counters::rpcErrored(std::string const& method)
|
||||
{
|
||||
std::scoped_lock lk(mutex_);
|
||||
MethodInfo& counters = methodInfo_[method];
|
||||
counters.started++;
|
||||
counters.errored++;
|
||||
++counters.started;
|
||||
++counters.errored;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -37,8 +46,8 @@ Counters::rpcComplete(std::string const& method, std::chrono::microseconds const
|
||||
{
|
||||
std::scoped_lock lk(mutex_);
|
||||
MethodInfo& counters = methodInfo_[method];
|
||||
counters.started++;
|
||||
counters.finished++;
|
||||
++counters.started;
|
||||
++counters.finished;
|
||||
counters.duration += rpcDuration.count();
|
||||
}
|
||||
|
||||
@@ -47,7 +56,45 @@ Counters::rpcForwarded(std::string const& method)
|
||||
{
|
||||
std::scoped_lock lk(mutex_);
|
||||
MethodInfo& counters = methodInfo_[method];
|
||||
counters.forwarded++;
|
||||
++counters.forwarded;
|
||||
}
|
||||
|
||||
void
|
||||
Counters::rpcFailedToForward(std::string const& method)
|
||||
{
|
||||
std::scoped_lock lk(mutex_);
|
||||
MethodInfo& counters = methodInfo_[method];
|
||||
++counters.failedForward;
|
||||
}
|
||||
|
||||
void
|
||||
Counters::onTooBusy()
|
||||
{
|
||||
++tooBusyCounter_;
|
||||
}
|
||||
|
||||
void
|
||||
Counters::onNotReady()
|
||||
{
|
||||
++notReadyCounter_;
|
||||
}
|
||||
|
||||
void
|
||||
Counters::onBadSyntax()
|
||||
{
|
||||
++badSyntaxCounter_;
|
||||
}
|
||||
|
||||
void
|
||||
Counters::onUnknownCommand()
|
||||
{
|
||||
++unknownCommandCounter_;
|
||||
}
|
||||
|
||||
void
|
||||
Counters::onInternalError()
|
||||
{
|
||||
++internalErrorCounter_;
|
||||
}
|
||||
|
||||
boost::json::object
|
||||
@@ -65,12 +112,20 @@ Counters::report() const
|
||||
counters[JS(started)] = std::to_string(info.started);
|
||||
counters[JS(finished)] = std::to_string(info.finished);
|
||||
counters[JS(errored)] = std::to_string(info.errored);
|
||||
counters[JS(failed)] = std::to_string(info.failed);
|
||||
counters["forwarded"] = std::to_string(info.forwarded);
|
||||
counters["failed_forward"] = std::to_string(info.failedForward);
|
||||
counters[JS(duration_us)] = std::to_string(info.duration);
|
||||
|
||||
rpc[method] = std::move(counters);
|
||||
}
|
||||
|
||||
obj["too_busy_errors"] = std::to_string(tooBusyCounter_);
|
||||
obj["not_ready_errors"] = std::to_string(notReadyCounter_);
|
||||
obj["bad_syntax_errors"] = std::to_string(badSyntaxCounter_);
|
||||
obj["unknown_command_errors"] = std::to_string(unknownCommandCounter_);
|
||||
obj["internal_errors"] = std::to_string(internalErrorCounter_);
|
||||
|
||||
obj["work_queue"] = workQueue_.get().report();
|
||||
|
||||
return obj;
|
||||
|
||||
Reference in New Issue
Block a user