]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: PutObj uses scope_guard to update perf counter on return
authorCasey Bodley <cbodley@redhat.com>
Wed, 10 Oct 2018 19:12:09 +0000 (15:12 -0400)
committerCasey Bodley <cbodley@redhat.com>
Tue, 16 Oct 2018 15:06:14 +0000 (11:06 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_op.cc

index 340551f94d5385dc9c1501cae64ba0ed5adee665..a59c4a968f079f90deb516cb71acca53b0601e3d 100644 (file)
@@ -14,6 +14,7 @@
 #include <boost/utility/in_place_factory.hpp>
 #include <boost/utility/string_view.hpp>
 
+#include "include/scope_guard.h"
 #include "common/Clock.h"
 #include "common/armor.h"
 #include "common/errno.h"
@@ -3556,6 +3557,11 @@ void RGWPutObj::execute()
 
   bool need_calc_md5 = (dlo_manifest == NULL) && (slo_info == NULL);
   perfcounter->inc(l_rgw_put);
+  // report latency on return
+  auto put_lat = make_scope_guard([&] {
+      perfcounter->tinc(l_rgw_put_lat, s->time_elapsed());
+    });
+
   op_ret = -EINVAL;
   if (s->object.empty()) {
     goto done;
@@ -3900,7 +3906,6 @@ void RGWPutObj::execute()
 
 done:
   dispose_processor(processor);
-  perfcounter->tinc(l_rgw_put_lat, s->time_elapsed());
 }
 
 int RGWPostObj::verify_permission()