]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os: stop using seastar::metrics::label
authorKefu Chai <tchaikov@gmail.com>
Mon, 28 Feb 2022 14:35:52 +0000 (22:35 +0800)
committerKefu Chai <tchaikov@gmail.com>
Tue, 1 Mar 2022 16:29:07 +0000 (00:29 +0800)
seastar::metrics::label was dropped in a recent change. quote from
the commit message which removed this type:

>     In practice, it's an over-kill and just add information in the reporting
>    layer.

see also da395f31989a1ee333e489ffb251fc1152f12f0a in seastar repo

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/crimson/os/seastore/cache.cc
src/crimson/os/seastore/seastore.cc
src/crimson/os/seastore/segment_manager/block.cc

index b3566855f17be35b98033c6e756e6ff86268fbb8..be848c60ce17b68a2f4ff0e5c5df43ae4a854f1d 100644 (file)
@@ -6,6 +6,8 @@
 #include <sstream>
 #include <string_view>
 
+#include <seastar/core/metrics.hh>
+
 #include "crimson/os/seastore/logging.h"
 #include "crimson/common/config_proxy.h"
 
@@ -120,28 +122,26 @@ void Cache::register_metrics()
   namespace sm = seastar::metrics;
   using src_t = Transaction::src_t;
 
-  auto src_label = sm::label("src");
   std::map<src_t, sm::label_instance> labels_by_src {
-    {src_t::MUTATE,  src_label("MUTATE")},
-    {src_t::READ,    src_label("READ")},
-    {src_t::CLEANER_TRIM, src_label("CLEANER_TRIM")},
-    {src_t::CLEANER_RECLAIM, src_label("CLEANER_RECLAIM")},
+    {src_t::MUTATE, sm::label_instance("src", "MUTATE")},
+    {src_t::READ, sm::label_instance("src", "READ")},
+    {src_t::CLEANER_TRIM, sm::label_instance("src", "CLEANER_TRIM")},
+    {src_t::CLEANER_RECLAIM, sm::label_instance("src", "CLEANER_RECLAIM")},
   };
 
-  auto ext_label = sm::label("ext");
   std::map<extent_types_t, sm::label_instance> labels_by_ext {
-    {extent_types_t::ROOT,                ext_label("ROOT")},
-    {extent_types_t::LADDR_INTERNAL,      ext_label("LADDR_INTERNAL")},
-    {extent_types_t::LADDR_LEAF,          ext_label("LADDR_LEAF")},
-    {extent_types_t::OMAP_INNER,          ext_label("OMAP_INNER")},
-    {extent_types_t::OMAP_LEAF,           ext_label("OMAP_LEAF")},
-    {extent_types_t::ONODE_BLOCK_STAGED,  ext_label("ONODE_BLOCK_STAGED")},
-    {extent_types_t::COLL_BLOCK,          ext_label("COLL_BLOCK")},
-    {extent_types_t::OBJECT_DATA_BLOCK,   ext_label("OBJECT_DATA_BLOCK")},
-    {extent_types_t::RETIRED_PLACEHOLDER, ext_label("RETIRED_PLACEHOLDER")},
-    {extent_types_t::RBM_ALLOC_INFO,      ext_label("RBM_ALLOC_INFO")},
-    {extent_types_t::TEST_BLOCK,          ext_label("TEST_BLOCK")},
-    {extent_types_t::TEST_BLOCK_PHYSICAL, ext_label("TEST_BLOCK_PHYSICAL")}
+    {extent_types_t::ROOT,                sm::label_instance("ext", "ROOT")},
+    {extent_types_t::LADDR_INTERNAL,      sm::label_instance("ext", "LADDR_INTERNAL")},
+    {extent_types_t::LADDR_LEAF,          sm::label_instance("ext", "LADDR_LEAF")},
+    {extent_types_t::OMAP_INNER,          sm::label_instance("ext", "OMAP_INNER")},
+    {extent_types_t::OMAP_LEAF,           sm::label_instance("ext", "OMAP_LEAF")},
+    {extent_types_t::ONODE_BLOCK_STAGED,  sm::label_instance("ext", "ONODE_BLOCK_STAGED")},
+    {extent_types_t::COLL_BLOCK,          sm::label_instance("ext", "COLL_BLOCK")},
+    {extent_types_t::OBJECT_DATA_BLOCK,   sm::label_instance("ext", "OBJECT_DATA_BLOCK")},
+    {extent_types_t::RETIRED_PLACEHOLDER, sm::label_instance("ext", "RETIRED_PLACEHOLDER")},
+    {extent_types_t::RBM_ALLOC_INFO,      sm::label_instance("ext", "RBM_ALLOC_INFO")},
+    {extent_types_t::TEST_BLOCK,          sm::label_instance("ext", "TEST_BLOCK")},
+    {extent_types_t::TEST_BLOCK_PHYSICAL, sm::label_instance("ext", "TEST_BLOCK_PHYSICAL")}
   };
 
   /*
index cf6743457fffd3f90ef74fedfb62cec4575892ef..db40a990ed56268f3307a444eebc90aa1a02d986 100644 (file)
@@ -150,16 +150,15 @@ void SeaStore::register_metrics()
 {
   namespace sm = seastar::metrics;
   using op_type_t = SeaStore::op_type_t;
-  auto lat_label = sm::label("latency");
   std::pair<op_type_t, sm::label_instance> labels_by_op_type[] = {
-    {op_type_t::TRANSACTION,     lat_label("TRANSACTION")},
-    {op_type_t::READ,            lat_label("READ")},
-    {op_type_t::WRITE,           lat_label("WRITE")},
-    {op_type_t::GET_ATTR,        lat_label("GET_ATTR")},
-    {op_type_t::GET_ATTRS,       lat_label("GET_ATTRS")},
-    {op_type_t::STAT,            lat_label("STAT")},
-    {op_type_t::OMAP_GET_VALUES, lat_label("OMAP_GET_VALUES")},
-    {op_type_t::OMAP_LIST,       lat_label("OMAP_LIST")},
+    {op_type_t::TRANSACTION,     sm::label_instance("latency", "TRANSACTION")},
+    {op_type_t::READ,            sm::label_instance("latency", "READ")},
+    {op_type_t::WRITE,           sm::label_instance("latency", "WRITE")},
+    {op_type_t::GET_ATTR,        sm::label_instance("latency", "GET_ATTR")},
+    {op_type_t::GET_ATTRS,       sm::label_instance("latency", "GET_ATTRS")},
+    {op_type_t::STAT,            sm::label_instance("latency", "STAT")},
+    {op_type_t::OMAP_GET_VALUES, sm::label_instance("latency",  "OMAP_GET_VALUES")},
+    {op_type_t::OMAP_LIST,       sm::label_instance("latency", "OMAP_LIST")},
   };
 
   for (auto& [op_type, label] : labels_by_op_type) {
index 88a57e7be8ef1b75a5f106322dd0f32976a9a3dd..c3814b3cd959a2f21ef74f77869f1f522be5fed5 100644 (file)
@@ -6,6 +6,8 @@
 
 #include <fmt/format.h>
 
+#include <seastar/core/metrics.hh>
+
 #include "include/buffer.h"
 
 #include "crimson/common/config_proxy.h"
@@ -687,9 +689,8 @@ void BlockSegmentManager::register_metrics()
   LOG_PREFIX(BlockSegmentManager::register_metrics);
   DEBUG("D{}", get_device_id());
   namespace sm = seastar::metrics;
-  sm::label label("device_id");
   std::vector<sm::label_instance> label_instances;
-  label_instances.push_back(label(get_device_id()));
+  label_instances.push_back(sm::label_instance("device_id", get_device_id()));
   stats.reset();
   metrics.add_group(
     "segment_manager",