From: Harsimran Singh Date: Tue, 26 May 2026 06:11:06 +0000 (+0530) Subject: rgw: add HEAD Object op metrics to perf counters and Prometheus export X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F69086%2Fhead;p=ceph.git rgw: add HEAD Object op metrics to perf counters and Prometheus export Expose HEAD Object operation metrics in the same format as existing RGW op metrics so operators can track HEAD request volume and latency at gateway, user, and bucket scope. Previously, HEAD Object requests were silently counted under get_obj_ops because RGWGetObj handles both GET and HEAD. The HEAD-specific early-return path (get_data == false) had no counter instrumentation. Fixes: ISCE-3042 Signed-off-by: Harsimran Singh --- diff --git a/doc/radosgw/metrics.rst b/doc/radosgw/metrics.rst index e27babcbaae..74b3a44d15a 100644 --- a/doc/radosgw/metrics.rst +++ b/doc/radosgw/metrics.rst @@ -74,6 +74,12 @@ The following metrics related to S3 or Swift operations are tracked per Ceph Obj * - list_bucket_lat - Gauge - Total latency of list bucket operations + * - head_obj_ops + - Counter + - Number of successful HEAD Object operations + * - head_obj_lat + - Gauge + - Total latency of HEAD Object operations There are three different sections in the output of the ``counter dump`` and ``counter schema`` commands that show the op metrics and their information. The sections are ``rgw_op``, ``rgw_op_per_user``, and ``rgw_op_per_bucket``. @@ -109,6 +115,12 @@ To view op metrics in the Ceph Object Gateway go to the ``rgw_op`` sections of t "avgcount": 1, "sum": 0.002300000, "avgtime": 0.002300000 + }, + "head_obj_ops": 3, + "head_obj_lat": { + "avgcount": 3, + "sum": 0.006123456, + "avgtime": 0.002041152 } } }, @@ -146,6 +158,12 @@ Op metrics can also be tracked per-user or per-bucket. These metrics are exporte "avgcount": 1, "sum": 0.002300000, "avgtime": 0.002300000 + }, + "head_obj_ops": 3, + "head_obj_lat": { + "avgcount": 3, + "sum": 0.006123456, + "avgtime": 0.002041152 } } }, diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index b9529e2524c..96baccea30a 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -2639,6 +2639,7 @@ void RGWGetObj::execute(optional_yield y) if (get_type() == RGW_OP_STAT_OBJ) { return; } + if (s->info.env->exists("HTTP_X_RGW_AUTH")) { op_ret = 0; goto done_err; @@ -2815,6 +2816,10 @@ void RGWGetObj::execute(optional_yield y) if (!get_data || ofs > end) { send_response_data(bl, 0, 0); + if (!get_data) { + rgw::op_counters::inc(counters, l_rgw_op_head_obj, 1); + rgw::op_counters::tinc(counters, l_rgw_op_head_obj_lat, s->time_elapsed()); + } return; } diff --git a/src/rgw/rgw_perf_counters.cc b/src/rgw/rgw_perf_counters.cc index 6019e449977..a5e0072e95a 100644 --- a/src/rgw/rgw_perf_counters.cc +++ b/src/rgw/rgw_perf_counters.cc @@ -93,6 +93,9 @@ void add_rgw_op_counters(PerfCountersBuilder *lpcb) { lpcb->add_u64_counter(l_rgw_op_list_buckets, "list_buckets_ops", "List buckets"); lpcb->add_time_avg(l_rgw_op_list_buckets_lat, "list_buckets_lat", "List buckets latency"); + + lpcb->add_u64_counter(l_rgw_op_head_obj, "head_obj_ops","Head object operations"); + lpcb->add_time_avg(l_rgw_op_head_obj_lat, "head_obj_lat","Head object latency"); } void add_rgw_topic_counters(PerfCountersBuilder *lpcb) { diff --git a/src/rgw/rgw_perf_counters.h b/src/rgw/rgw_perf_counters.h index e93b4fe36f9..5c3e724d26c 100644 --- a/src/rgw/rgw_perf_counters.h +++ b/src/rgw/rgw_perf_counters.h @@ -83,7 +83,10 @@ enum { l_rgw_op_list_buckets, l_rgw_op_list_buckets_lat, - + + l_rgw_op_head_obj, + l_rgw_op_head_obj_lat, + l_rgw_op_last };