10 const std::vector<double>
buckets = {1000, 10000, 100000, 1000000, 10000000};
15 void
report(const
std::
string &request, const
std::
string &ip, const
std::
string &connection,
16 uint64_t request_duration) {
17 std::vector<std::string_view> methods;
18 std::string_view req_view(request);
20 std::string_view method_key =
"\"method\":";
21 size_t method_pos = req_view.find(method_key, start);
23 while (method_pos != std::string_view::npos) {
24 start = method_pos + method_key.size();
26 while (start < req_view.size() && (req_view[start] ==
' ' || req_view[start] ==
'"')) {
29 size_t end = req_view.find(
'"', start);
30 if (end != std::string_view::npos) {
31 methods.push_back(req_view.substr(start, end - start));
37 method_pos = req_view.find(method_key, start);
41 for (
const auto &method : methods) {
42 setJsonRpcRequestDuration(request_duration,
43 {{
"method", std::string(method)}, {
"ip", ip}, {
"connection", connection}});