From df7366eaceb4bd858cc9fa9b1de8e9695c81901d Mon Sep 17 00:00:00 2001 From: Brad Ison Date: Thu, 15 Dec 2016 13:20:16 -0500 Subject: [PATCH] Add chunk size metric --- endpoints/v1/registry.py | 2 ++ util/metrics/metricqueue.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/endpoints/v1/registry.py b/endpoints/v1/registry.py index c6f6f71f4..f0bcc11b8 100644 --- a/endpoints/v1/registry.py +++ b/endpoints/v1/registry.py @@ -199,6 +199,8 @@ def put_image_layer(namespace, repository, image_id): try: start_time = time() store.stream_write(locations, path, sr) + metric_queue.chunk_size.Observe(size_info.compressed_size, + labelvalues=[list(locations)[0]]) metric_queue.chunk_upload_time.Observe(time() - start_time, labelvalues=[list(locations)[0]]) except IOError: diff --git a/util/metrics/metricqueue.py b/util/metrics/metricqueue.py index cbb8e5fe4..5dba0ea97 100644 --- a/util/metrics/metricqueue.py +++ b/util/metrics/metricqueue.py @@ -73,6 +73,10 @@ class MetricQueue(object): labelnames=['namespace', 'repo_name', 'status', 'executor']) + self.chunk_size = prom.create_histogram('chunk_size', + 'Registry blob chunk size', + labelnames=['storage_region']) + self.chunk_upload_time = prom.create_histogram('chunk_upload_time', 'Registry blob chunk upload time', labelnames=['storage_region'])