From: Yingxin Cheng Date: Tue, 27 Jul 2021 08:45:03 +0000 (+0800) Subject: crimson/os/seastore/cache: remove counter labels X-Git-Tag: v17.1.0~1254^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=08a95d07b73950c88253232c59d0dba0650d4b75;p=ceph.git crimson/os/seastore/cache: remove counter labels Do not label metrics by counter type which could be confusing. Signed-off-by: Yingxin Cheng --- diff --git a/src/crimson/os/seastore/cache.cc b/src/crimson/os/seastore/cache.cc index 1fc7cdb146b..82a5712fef4 100644 --- a/src/crimson/os/seastore/cache.cc +++ b/src/crimson/os/seastore/cache.cc @@ -113,13 +113,6 @@ void Cache::register_metrics() {extent_types_t::TEST_BLOCK_PHYSICAL, ext_label("TEST_BLOCK_PHYSICAL")} }; - auto counter_label = sm::label("counter"); - std::map labels_by_counter { - {"EXTENTS", counter_label("EXTENTS")}, - {"BYTES", counter_label("BYTES")}, - {"DELTA_BYTES", counter_label("DELTA_BYTES")}, - }; - /* * trans_created */ @@ -414,27 +407,21 @@ void Cache::register_metrics() * read_effort_successful */ stats.read_effort_successful = {}; - auto register_read_effort_successful = - [this, &labels_by_counter] - (const char* counter_name, uint64_t& value) { - std::ostringstream oss_desc; - oss_desc << "total successful read transactional effort labeled by counter"; - metrics.add_group( - "cache", - { - sm::make_counter( - "read_effort_successful", - value, - sm::description(oss_desc.str()), - {labels_by_counter.find(counter_name)->second} - ), - } - ); - }; - for (auto& counter_name : {"EXTENTS", "BYTES"}) { - auto& value = stats.read_effort_successful.get_by_name(counter_name); - register_read_effort_successful(counter_name, value); - } + metrics.add_group( + "cache", + { + sm::make_counter( + "successful_read_extents", + stats.read_effort_successful.extents, + sm::description("extents of successful read transactions") + ), + sm::make_counter( + "successful_read_extent_bytes", + stats.read_effort_successful.bytes, + sm::description("extent bytes of successful read transactions") + ), + } + ); } /** @@ -451,30 +438,26 @@ void Cache::register_metrics() [this] { return extents.size(); }, - sm::description("total number of cached extents"), - {labels_by_counter.find("EXTENTS")->second} + sm::description("total number of cached extents") ), sm::make_counter( - "cached_extents", + "cached_extent_bytes", [this] { return extents.get_bytes(); }, - sm::description("total bytes of cached extents"), - {labels_by_counter.find("BYTES")->second} + sm::description("total bytes of cached extents") ), sm::make_counter( "dirty_extents", [this] { return dirty.size(); }, - sm::description("total number of dirty extents"), - {labels_by_counter.find("EXTENTS")->second} + sm::description("total number of dirty extents") ), sm::make_counter( - "dirty_extents", + "dirty_extent_bytes", stats.dirty_bytes, - sm::description("total bytes of dirty extents"), - {labels_by_counter.find("BYTES")->second} + sm::description("total bytes of dirty extents") ), } ); diff --git a/src/crimson/os/seastore/cache.h b/src/crimson/os/seastore/cache.h index 1c141cc4eb5..f3f3c035e08 100644 --- a/src/crimson/os/seastore/cache.h +++ b/src/crimson/os/seastore/cache.h @@ -608,15 +608,6 @@ private: uint64_t extents = 0; uint64_t bytes = 0; - uint64_t& get_by_name(const std::string& counter_name) { - if (counter_name == "EXTENTS") { - return extents; - } else { - ceph_assert(counter_name == "BYTES"); - return bytes; - } - } - void increment(uint64_t extent_len) { ++extents; bytes += extent_len;