mirror of
https://github.com/typesense/typesense.git
synced 2025-05-17 12:12:35 +08:00
Add total rps to app metrics.
This commit is contained in:
parent
4d1390ce91
commit
0bc15e013b
@ -71,11 +71,16 @@ public:
|
||||
void get(const std::string& count_key, const std::string& latency_key, nlohmann::json &result) const {
|
||||
std::shared_lock lock(mutex);
|
||||
|
||||
uint64_t total_counts = 0;
|
||||
|
||||
result[count_key] = nlohmann::json::object();
|
||||
for(const auto& kv: *counts) {
|
||||
result[count_key][kv.first] = (double(kv.second) / (METRICS_REFRESH_INTERVAL_MS / 1000));
|
||||
total_counts += kv.second;
|
||||
}
|
||||
|
||||
result["total_"+count_key] = double(total_counts) / (METRICS_REFRESH_INTERVAL_MS / 1000);
|
||||
|
||||
result[latency_key] = nlohmann::json::object();
|
||||
for(const auto& kv: *durations) {
|
||||
auto counter_it = counts->find(kv.first);
|
||||
|
Loading…
x
Reference in New Issue
Block a user