]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: finish adding the bool config var for perf counters cache
authorAli Maredia <amaredia@redhat.com>
Sun, 4 Dec 2022 22:42:39 +0000 (17:42 -0500)
committerAli Maredia <amaredia@redhat.com>
Sun, 4 Dec 2022 22:42:39 +0000 (17:42 -0500)
Signed-off-by: Ali Maredia <amaredia@redhat.com>
src/common/options/rgw.yaml.in
src/rgw/rgw_op.cc

index 33fe0a607948ac2fcd3717c12edf96d74898f692..cce68e6401b8f0c0d2a1dc3e32a625cf9a259421 100644 (file)
@@ -3692,3 +3692,10 @@ options:
   default: tank
   services:
   - rgw
+- name: rgw_perf_counters_cache
+  type: bool
+  level: dev
+  default: false
+  desc: If set to true, rgw creates labeled perf counters and stores them in it's perf counters cache.
+  services:
+  - rgw
index bfae8af1fd05a48bbc3ddaba258120859af17510..f1f6173ae9673f62be2be782d22b0af43b7799f8 100644 (file)
@@ -2154,6 +2154,7 @@ void RGWGetObj::execute(optional_yield y)
   std::unique_ptr<RGWGetObj_Filter> run_lua;
   map<string, bufferlist>::iterator attr_iter;
   std::string labels;
+  bool rgw_perf_counters_cache;
 
   perfcounter->inc(l_rgw_get);
 
@@ -2322,11 +2323,14 @@ void RGWGetObj::execute(optional_yield y)
     return;
   }
 
-  labels = ceph::perf_counters::cache_key("z_rgw", {{"Bucket", s->bucket_name}, {"User", s->user->get_display_name()}});
-  // TODO delete logging
-  ldpp_dout(this, 20) << "labels for perf counters cache for l_rgw_metrics_get_b: " << labels << dendl;
-  perf_counters_cache->add(labels);
-  perf_counters_cache->inc(labels, l_rgw_get_b, s->obj_size);
+  rgw_perf_counters_cache = s->cct->_conf.get_val<bool>("rgw_perf_counters_cache");
+  if(rgw_perf_counters_cache) {
+    labels = ceph::perf_counters::cache_key("z_rgw", {{"Bucket", s->bucket_name}, {"User", s->user->get_display_name()}});
+    // TODO delete logging
+    ldpp_dout(this, 20) << "labels for perf counters cache for l_rgw_metrics_get_b: " << labels << dendl;
+    perf_counters_cache->add(labels);
+    perf_counters_cache->inc(labels, l_rgw_get_b, s->obj_size);
+  }
 
   perfcounter->inc(l_rgw_get_b, end - ofs);
 
@@ -2336,7 +2340,11 @@ void RGWGetObj::execute(optional_yield y)
     op_ret = filter->flush();
 
   perfcounter->tinc(l_rgw_get_lat, s->time_elapsed());
-  perf_counters_cache->tinc(labels, l_rgw_get_lat, s->time_elapsed());
+
+  if(rgw_perf_counters_cache) {
+    perf_counters_cache->tinc(labels, l_rgw_get_lat, s->time_elapsed());
+  }
+
   if (op_ret < 0) {
     goto done_err;
   }
@@ -3908,14 +3916,17 @@ void RGWPutObj::execute(optional_yield y)
   off_t fst;
   off_t lst;
 
+  bool rgw_perf_counters_cache = s->cct->_conf.get_val<bool>("rgw_perf_counters_cache");
   std::string labels = ceph::perf_counters::cache_key("z_rgw", {{"Bucket", s->bucket_name}, {"User", s->user->get_display_name()}});
-  // TODO delete below logging
-  ldpp_dout(this, 20) << "labels for perf counters cache for l_rgw_metrics_put_b: " << labels << dendl;
-  uint64_t target_size = s->cct->_conf.get_val<uint64_t>("labeled_perfcounters_cache_size");
-  bool eviction = s->cct->_conf.get_val<bool>("labeled_perfcounters_cache_eviction");
-  ldpp_dout(this, 20) << "target size for perf counters cache is: " << target_size << " eviction is: " << eviction << dendl;
+  if(rgw_perf_counters_cache) {
+    // TODO delete below logging
+    ldpp_dout(this, 20) << "labels for perf counters cache for l_rgw_metrics_put_b: " << labels << dendl;
+    uint64_t target_size = s->cct->_conf.get_val<uint64_t>("labeled_perfcounters_cache_size");
+    bool eviction = s->cct->_conf.get_val<bool>("labeled_perfcounters_cache_eviction");
+    ldpp_dout(this, 20) << "target size for perf counters cache is: " << target_size << " eviction is: " << eviction << dendl;
 
-  perf_counters_cache->add(labels);
+    perf_counters_cache->add(labels);
+  }
 
   bool need_calc_md5 = (dlo_manifest == NULL) && (slo_info == NULL);
   perfcounter->inc(l_rgw_put);
@@ -3923,6 +3934,8 @@ void RGWPutObj::execute(optional_yield y)
   auto put_lat = make_scope_guard([&] {
       perfcounter->tinc(l_rgw_put_lat, s->time_elapsed());
       perf_counters_cache->tinc(labels, l_rgw_put_lat, s->time_elapsed());
+      //if(rgw_perf_counters_cache) {
+      //}
     });
 
   op_ret = -EINVAL;
@@ -4184,7 +4197,10 @@ void RGWPutObj::execute(optional_yield y)
   s->obj_size = ofs;
   s->object->set_obj_size(ofs);
 
-  perf_counters_cache->inc(labels, l_rgw_put_b, s->obj_size);
+  rgw_perf_counters_cache = s->cct->_conf.get_val<bool>("rgw_perf_counters_cache");
+  if(rgw_perf_counters_cache) {
+    perf_counters_cache->inc(labels, l_rgw_put_b, s->obj_size);
+  }
 
   perfcounter->inc(l_rgw_put_b, s->obj_size);