From 313959ae9253681760a5639c1256aa036692a603 Mon Sep 17 00:00:00 2001 From: Yan Xiao Date: Tue, 27 May 2025 15:16:51 -0400 Subject: [PATCH] Object-server: change labeled timing metrics sample rate for debugging requests The labeled timing metrics previously have sample_rate similar to those added for non-labeled metrics. However the down sampling has not been helpful when using labeled metrics to investigate customer issues, for example those related to object server REPLICATE requests. This patch changes labeled timing metrics to not have sample_rate. The non-labeled metrics are unrelated to this effort thus not changed. Related-Change: I05336b700120ab5fcf922590d6a12f73112edb50 Change-Id: Ia6e856ffaf8fd1b4a905e6976ebdc62ed5ddf32f --- swift/obj/server.py | 6 +++--- test/unit/obj/test_server.py | 24 ++++++++---------------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/swift/obj/server.py b/swift/obj/server.py index fc64fb9bf6..fe2b769d8b 100644 --- a/swift/obj/server.py +++ b/swift/obj/server.py @@ -1198,7 +1198,7 @@ class ObjectController(BaseStorageServer): @public @timing_stats(sample_rate=0.8) - @labeled_timing_stats(metric=LABELED_METRIC_NAME, sample_rate=0.8) + @labeled_timing_stats(metric=LABELED_METRIC_NAME) def HEAD(self, request, timing_stats_labels): """Handle HTTP HEAD requests for the Swift Object Server.""" device, partition, account, container, obj, policy = \ @@ -1357,7 +1357,7 @@ class ObjectController(BaseStorageServer): @public @replication @timing_stats(sample_rate=0.1) - @labeled_timing_stats(metric=LABELED_METRIC_NAME, sample_rate=0.1) + @labeled_timing_stats(metric=LABELED_METRIC_NAME) def REPLICATE(self, request, timing_stats_labels): """ Handle REPLICATE requests for the Swift Object Server. This is used @@ -1388,7 +1388,7 @@ class ObjectController(BaseStorageServer): @public @replication @timing_stats(sample_rate=0.1) - @labeled_timing_stats(metric=LABELED_METRIC_NAME, sample_rate=0.1) + @labeled_timing_stats(metric=LABELED_METRIC_NAME) def SSYNC(self, request, timing_stats_labels): # the ssync sender may want to send PUT subrequests for non-durable # data that should not be committed; legacy behaviour has been to diff --git a/test/unit/obj/test_server.py b/test/unit/obj/test_server.py index 666b5a0006..2dee1d0f46 100644 --- a/test/unit/obj/test_server.py +++ b/test/unit/obj/test_server.py @@ -356,8 +356,7 @@ class TestObjectController(BaseTestCase): 'container': 'c', 'policy': 0, 'status': 200 - }, - 'sample_rate': 0.8 + } })] }, statsd.calls) @@ -412,8 +411,7 @@ class TestObjectController(BaseTestCase): 'policy': 0, 'skip_rehash': False, 'status': 200 - }, - 'sample_rate': 0.1 + } })]}, statsd.calls) @@ -434,8 +432,7 @@ class TestObjectController(BaseTestCase): 'policy': 0, 'skip_rehash': True, 'status': 200 - }, - 'sample_rate': 0.1 + } })]}, statsd.calls) @@ -458,8 +455,7 @@ class TestObjectController(BaseTestCase): 'policy': 1, 'skip_rehash': False, 'status': 200 - }, - 'sample_rate': 0.1 + } })]}, statsd.calls) @@ -479,8 +475,7 @@ class TestObjectController(BaseTestCase): 'method': 'SSYNC', 'policy': 0, 'status': 200 - }, - 'sample_rate': 0.1 + } })] }, statsd.calls) @@ -500,8 +495,7 @@ class TestObjectController(BaseTestCase): 'policy': 0, 'status': 507, **additional_labels - }, - **kwargs + } })] }, statsd.calls) @@ -587,8 +581,7 @@ class TestObjectController(BaseTestCase): 'labels': { 'method': req.method, 'status': 507, - }, - **kwargs + } })] }, statsd.calls) @@ -606,8 +599,7 @@ class TestObjectController(BaseTestCase): 'labels': { 'method': req.method, 'status': 503, - }, - **kwargs + } })] }, statsd.calls)