From: Casey Bodley Date: Wed, 10 Oct 2018 19:12:09 +0000 (-0400) Subject: rgw: PutObj uses scope_guard to update perf counter on return X-Git-Tag: v14.1.0~1156^2~17 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6b6002a802360f8ff21ce0a12c16a8f9f64dc322;p=ceph.git rgw: PutObj uses scope_guard to update perf counter on return Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 340551f94d53..a59c4a968f07 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -14,6 +14,7 @@ #include #include +#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()