Skip to content

Commit

Permalink
feat(collector): add statistics for estimate key number of table (#437)
Browse files Browse the repository at this point in the history
  • Loading branch information
foreverneverer authored and Wu Tao committed Dec 5, 2019
1 parent c072e5d commit 59e54d6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
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

0 comments on commit 59e54d6

Please sign in to comment.