Skip to content

Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences

Add total rps to app metrics.

Kishore Nalland8cca1e2003d
diff --git a/include/app_metrics.h b/include/app_metrics.h
index 5db588ca..40712681 100644
--- a/include/app_metrics.h
+++ b/include/app_metrics.h
@@ -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);