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

feat(collector): add statistics for estimate key number of table #437

Merged
merged 3 commits into from
Dec 5, 2019
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
3 changes: 3 additions & 0 deletions src/server/info_collector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ void info_collector::on_app_stat()
all.rdb_block_cache_total_count += row.rdb_block_cache_total_count;
all.rdb_index_and_filter_blocks_mem_usage += row.rdb_index_and_filter_blocks_mem_usage;
all.rdb_memtable_mem_usage += row.rdb_memtable_mem_usage;
all.rdb_estimate_num_keys += row.rdb_estimate_num_keys;
read_qps[i] = row.get_qps + row.multi_get_qps + row.scan_qps;
write_qps[i] = row.put_qps + row.multi_put_qps + row.remove_qps + row.multi_remove_qps +
row.incr_qps + row.check_and_set_qps + row.check_and_mutate_qps;
Expand Down Expand Up @@ -205,6 +206,7 @@ void info_collector::on_app_stat()
counters->rdb_index_and_filter_blocks_mem_usage->set(
row.rdb_index_and_filter_blocks_mem_usage);
counters->rdb_memtable_mem_usage->set(row.rdb_memtable_mem_usage);
counters->rdb_estimate_num_keys->set(row.rdb_estimate_num_keys);
counters->read_qps->set(read_qps[i]);
counters->write_qps->set(write_qps[i]);
}
Expand Down Expand Up @@ -255,6 +257,7 @@ info_collector::AppStatCounters *info_collector::get_app_counters(const std::str
INIT_COUNTER(rdb_block_cache_hit_rate);
INIT_COUNTER(rdb_index_and_filter_blocks_mem_usage);
INIT_COUNTER(rdb_memtable_mem_usage);
INIT_COUNTER(rdb_estimate_num_keys);
INIT_COUNTER(read_qps);
INIT_COUNTER(write_qps);
_app_stat_counters[app_name] = counters;
Expand Down
1 change: 1 addition & 0 deletions src/server/info_collector.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class info_collector
::dsn::perf_counter_wrapper rdb_block_cache_mem_usage;
::dsn::perf_counter_wrapper rdb_index_and_filter_blocks_mem_usage;
::dsn::perf_counter_wrapper rdb_memtable_mem_usage;
::dsn::perf_counter_wrapper rdb_estimate_num_keys;
::dsn::perf_counter_wrapper read_qps;
::dsn::perf_counter_wrapper write_qps;
};
Expand Down
3 changes: 3 additions & 0 deletions src/shell/command_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ struct row_data
double rdb_block_cache_total_count = 0;
double rdb_index_and_filter_blocks_mem_usage = 0;
double rdb_memtable_mem_usage = 0;
double rdb_estimate_num_keys = 0;
};

inline bool
Expand Down Expand Up @@ -589,6 +590,8 @@ update_app_pegasus_perf_counter(row_data &row, const std::string &counter_name,
row.rdb_index_and_filter_blocks_mem_usage += value;
else if (counter_name == "rdb.memtable.memory_usage")
row.rdb_memtable_mem_usage += value;
else if (counter_name == "rdb.estimate_num_keys")
row.rdb_estimate_num_keys += value;
else
return false;
return true;
Expand Down