Report inode space usage statistics to etcd, aggregate it in the monitor
This commit is contained in:
+1
-1
@@ -43,7 +43,7 @@ std::unordered_map<object_id, uint64_t> & blockstore_t::get_unstable_writes()
|
||||
return impl->unstable_writes;
|
||||
}
|
||||
|
||||
std::map<uint64_t, int64_t> & blockstore_t::get_inode_space_stats()
|
||||
std::map<uint64_t, uint64_t> & blockstore_t::get_inode_space_stats()
|
||||
{
|
||||
return impl->inode_space_stats;
|
||||
}
|
||||
|
||||
+1
-1
@@ -184,7 +184,7 @@ public:
|
||||
std::unordered_map<object_id, uint64_t> & get_unstable_writes();
|
||||
|
||||
// Get per-inode space usage statistics
|
||||
std::map<uint64_t, int64_t> & get_inode_space_stats();
|
||||
std::map<uint64_t, uint64_t> & get_inode_space_stats();
|
||||
|
||||
// FIXME rename to object_size
|
||||
uint32_t get_block_size();
|
||||
|
||||
@@ -328,7 +328,7 @@ public:
|
||||
std::unordered_map<object_id, uint64_t> unstable_writes;
|
||||
|
||||
// Space usage statistics
|
||||
std::map<uint64_t, int64_t> inode_space_stats;
|
||||
std::map<uint64_t, uint64_t> inode_space_stats;
|
||||
|
||||
inline uint32_t get_block_size() { return block_size; }
|
||||
inline uint64_t get_block_count() { return block_count; }
|
||||
|
||||
+12
-1
@@ -180,11 +180,22 @@ void osd_t::report_statistics()
|
||||
return;
|
||||
}
|
||||
etcd_reporting_stats = true;
|
||||
// Report space usage statistics as a whole
|
||||
// Maybe we'll report it using deltas if we tune for a lot of inodes at some point
|
||||
json11::Json::object inode_space;
|
||||
for (auto kv: bs->get_inode_space_stats())
|
||||
{
|
||||
inode_space[std::to_string(kv.first)] = kv.second;
|
||||
}
|
||||
json11::Json::array txn = { json11::Json::object {
|
||||
{ "request_put", json11::Json::object {
|
||||
{ "key", base64_encode(st_cli.etcd_prefix+"/osd/stats/"+std::to_string(osd_num)) },
|
||||
{ "value", base64_encode(get_statistics().dump()) },
|
||||
} }
|
||||
} },
|
||||
{ "request_put", json11::Json::object {
|
||||
{ "key", base64_encode(st_cli.etcd_prefix+"/osd/space/"+std::to_string(osd_num)) },
|
||||
{ "value", base64_encode(json11::Json(inode_space).dump()) },
|
||||
} },
|
||||
} };
|
||||
for (auto & p: pgs)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user