diff --git a/server/confdata-stats.cpp b/server/confdata-stats.cpp index 8f9b4f335b..088d7f2b80 100644 --- a/server/confdata-stats.cpp +++ b/server/confdata-stats.cpp @@ -39,6 +39,8 @@ void ConfdataStats::on_update(const confdata_sample_storage &new_confdata, predefined_wildcard_elements = 0; heaviest_sections_by_count.clear(); + total_rb_tree_size = new_confdata.size(); + for (const auto §ion: new_confdata) { const vk::string_view first_key{section.first.c_str(), section.first.size()}; switch (confdata_predefined_wildcards.detect_first_key_type(first_key)) { @@ -75,6 +77,9 @@ void ConfdataStats::on_update(const confdata_sample_storage &new_confdata, } } + if (last_update_time_point.time_since_epoch() > std::chrono::nanoseconds::zero()) { + time_since_last_update = std::chrono::steady_clock::now() - last_update_time_point; + } last_update_time_point = std::chrono::steady_clock::now(); } diff --git a/server/confdata-stats.h b/server/confdata-stats.h index 9b9063f00b..7952d7b29e 100644 --- a/server/confdata-stats.h +++ b/server/confdata-stats.h @@ -17,6 +17,7 @@ struct ConfdataStats : private vk::not_copyable { std::chrono::nanoseconds initial_loading_time{std::chrono::nanoseconds::zero()}; std::chrono::nanoseconds total_updating_time{std::chrono::nanoseconds::zero()}; + std::chrono::nanoseconds time_since_last_update{std::chrono::nanoseconds::zero()}; std::chrono::steady_clock::time_point last_update_time_point{std::chrono::nanoseconds::zero()}; size_t total_updates{0}; @@ -36,6 +37,8 @@ struct ConfdataStats : private vk::not_copyable { size_t predefined_wildcard_elements{0}; size_t elements_with_delay{0}; + size_t total_rb_tree_size{0}; + struct EventCounters { struct Event { size_t total{0}; diff --git a/server/statshouse/statshouse-manager.cpp b/server/statshouse/statshouse-manager.cpp index 45794e82c6..b6c76ce995 100644 --- a/server/statshouse/statshouse-manager.cpp +++ b/server/statshouse/statshouse-manager.cpp @@ -334,6 +334,16 @@ void StatsHouseManager::add_confdata_master_stats(const ConfdataStats &confdata_ client.metric("kphp_confdata_memory").tag("used").write_value(memory_stats.memory_used); client.metric("kphp_confdata_memory").tag("real_used").write_value(memory_stats.real_memory_used); + client.metric("kphp_confdata_tree_nodes").tag("no_dots").write_value(confdata_stats.simple_key_elements); + client.metric("kphp_confdata_tree_nodes").tag("one_dot").write_value(confdata_stats.one_dot_wildcards); + client.metric("kphp_confdata_tree_nodes").tag("two_dots").write_value(confdata_stats.two_dots_wildcards); + client.metric("kphp_confdata_tree_nodes").tag("predefined_wildcard").write_value(confdata_stats.predefined_wildcards); + client.metric("kphp_confdata_tree_nodes").tag("total").write_value(confdata_stats.total_rb_tree_size); + + if (confdata_stats.time_since_last_update > std::chrono::nanoseconds::zero()) { + client.metric("kphp_confdata_time_since_last_update").write_value(confdata_stats.time_since_last_update.count()); + } + const auto &events = confdata_stats.event_counters; client.metric("kphp_confdata_events").tag("set").write_value(events.set_events.total + events.set_forever_events.total); client.metric("kphp_confdata_events").tag("set_blacklisted").write_value(events.set_events.blacklisted + events.set_forever_events.blacklisted);