]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: add HEAD Object op metrics to perf counters and Prometheus export 69086/head
authorHarsimran Singh <hsthukral51@gmail.com>
Tue, 26 May 2026 06:11:06 +0000 (11:41 +0530)
committerHarsimran Singh <hsthukral51@gmail.com>
Tue, 26 May 2026 06:11:06 +0000 (11:41 +0530)
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 <harsimransingh@ibm.com>
doc/radosgw/metrics.rst
src/rgw/rgw_op.cc
src/rgw/rgw_perf_counters.cc
src/rgw/rgw_perf_counters.h

index e27babcbaaeaeb964396098cbadeee73be8c958e..74b3a44d15a85be1e727ac6b30b965c20070d165 100644 (file)
@@ -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
                 }
             }
         },
index b9529e2524c5e6dac4d281e2b96b6a31d3c64da2..96baccea30a0382b00baf9f71da4d4f8f3d8e08b 100644 (file)
@@ -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;
   }
 
index 6019e449977bb64533b4a93bf0d8257cb26def88..a5e0072e95a8250e23fdf6c0894d716d79b1a9c9 100644 (file)
@@ -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) {
index e93b4fe36f91c30939328afb92855ce22f395034..5c3e724d26c58c8db64eadbfe56afb470f6d1520 100644 (file)
@@ -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
 };