22#include "rpc/WorkQueue.hpp"
23#include "util/prometheus/Counter.hpp"
25#include <boost/json.hpp>
26#include <boost/json/object.hpp>
32#include <unordered_map>
40 using CounterType = std::reference_wrapper<util::prometheus::CounterInt>;
45 MethodInfo(std::string
const& method);
51 CounterType forwarded;
52 CounterType failedForward;
57 getMethodInfo(std::string
const& method);
59 mutable std::mutex mutex_;
60 std::unordered_map<std::string, MethodInfo> methodInfo_;
63 CounterType tooBusyCounter_;
64 CounterType notReadyCounter_;
65 CounterType badSyntaxCounter_;
66 CounterType unknownCommandCounter_;
67 CounterType internalErrorCounter_;
69 std::reference_wrapper<WorkQueue const> workQueue_;
70 std::chrono::time_point<std::chrono::system_clock> startupTime_;
115 rpcComplete(std::string
const& method, std::chrono::microseconds
const& rpcDuration);
Holds information about successful, failed, forwarded, etc. RPC handler calls.
Definition Counters.hpp:39
void rpcComplete(std::string const &method, std::chrono::microseconds const &rpcDuration)
Increments the completed count for a particular RPC method.
Definition Counters.cpp:141
void onNotReady()
Increments the global not ready counter.
Definition Counters.cpp:173
void rpcForwarded(std::string const &method)
Increments the forwarded count for a particular RPC method.
Definition Counters.cpp:151
void rpcFailedToForward(std::string const &method)
Increments the failed to forward count for a particular RPC method.
Definition Counters.cpp:159
Counters(WorkQueue const &wq)
Creates a new counters instance that operates on the given WorkQueue.
Definition Counters.cpp:91
static Counters makeCounters(WorkQueue const &wq)
A factory function that creates a new counters instance.
Definition Counters.hpp:87
void onInternalError()
Increments the global internal error counter.
Definition Counters.cpp:191
std::chrono::seconds uptime() const
Definition Counters.cpp:197
void rpcFailed(std::string const &method)
Increments the failed count for a particular RPC method.
Definition Counters.cpp:123
boost::json::object report() const
Definition Counters.cpp:203
void onTooBusy()
Increments the global too busy counter.
Definition Counters.cpp:167
void onBadSyntax()
Increments the global bad syntax counter.
Definition Counters.cpp:179
void onUnknownCommand()
Increments the global unknown command/method counter.
Definition Counters.cpp:185
void rpcErrored(std::string const &method)
Increments the errored count for a particular RPC method.
Definition Counters.cpp:132
An asynchronous, thread-safe queue for RPC requests.
Definition WorkQueue.hpp:46
This namespace contains all the RPC logic and handlers.
Definition AMMHelpers.cpp:36