Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new confdata statshouse metrics #1148

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions server/confdata-stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 &section: 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)) {
Expand Down Expand Up @@ -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();
}

Expand Down
3 changes: 3 additions & 0 deletions server/confdata-stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -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()};
DrDet marked this conversation as resolved.
Show resolved Hide resolved
std::chrono::steady_clock::time_point last_update_time_point{std::chrono::nanoseconds::zero()};

size_t total_updates{0};
Expand All @@ -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};
Expand Down
10 changes: 10 additions & 0 deletions server/statshouse/statshouse-manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
DrDet marked this conversation as resolved.
Show resolved Hide resolved

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());
astrophysik marked this conversation as resolved.
Show resolved Hide resolved
}

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);
Expand Down
Loading