From 95d8455841d9a5ff77c16a6fdb3aaf402a3d4753 Mon Sep 17 00:00:00 2001 From: Jennifer Richards Date: Wed, 19 Feb 2025 13:06:05 -0400 Subject: [PATCH] chore: log timing of blob reads --- ietf/doc/storage_utils.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ietf/doc/storage_utils.py b/ietf/doc/storage_utils.py index 4ce9f94c8c..4f0516339a 100644 --- a/ietf/doc/storage_utils.py +++ b/ietf/doc/storage_utils.py @@ -79,11 +79,18 @@ def store_str( def retrieve_bytes(kind: str, name: str) -> bytes: + from ietf.doc.storage_backends import maybe_log_timing content = b"" if settings.ENABLE_BLOBSTORAGE: store = _get_storage(kind) with store.open(name) as f: - content = f.read() + with maybe_log_timing( + hasattr(store, "ietf_log_blob_timing") and store.ietf_log_blob_timing, + "read", + bucket_name=store.bucket_name if hasattr(store, "bucket_name") else "", + name=name, + ): + content = f.read() return content