From 6dcb8c713474b21e66148e055579b63d766f192e Mon Sep 17 00:00:00 2001 From: Sigurd Pettersen Date: Fri, 22 Nov 2024 15:06:42 +0100 Subject: [PATCH] timing --- backend_py/primary/primary/routers/surface/router.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/backend_py/primary/primary/routers/surface/router.py b/backend_py/primary/primary/routers/surface/router.py index 385798bd4..6e618c57b 100644 --- a/backend_py/primary/primary/routers/surface/router.py +++ b/backend_py/primary/primary/routers/surface/router.py @@ -352,11 +352,16 @@ def compute_hash(numbers: List[int]) -> str: cached_data = await redis_client.get(my_cache_key) perf_metrics.record_lap("cache-lookup") + response_perf_metrics.record_lap("cache-lookup") + if cached_data: LOGGER.info(f"!!!!!!!!!!!!!!!!!!!!Returning CACHED result in: {perf_metrics.to_string()}") - response_perf_metrics.record_lap("func-total-cached") - return ta.validate_json(cached_data) + ret_val = ta.validate_json(cached_data) + response_perf_metrics.record_lap("cache-parse") + + response_perf_metrics.record_elapsed("func-total-cached") + return ret_val sumo_access_token = authenticated_user.get_sumo_access_token() perf_metrics.record_lap("get-access-token") @@ -392,7 +397,7 @@ def compute_hash(numbers: List[int]) -> str: LOGGER.info(f"Sampled surface in points in: {perf_metrics.to_string()}") - response_perf_metrics.record_lap("func-total-uncached") + response_perf_metrics.record_elapsed("func-total-uncached") return intersections