From 2a9ce209f1a60693b80d3d3815f59fa693fbc08e Mon Sep 17 00:00:00 2001 From: Bernard Szabo Date: Thu, 18 Aug 2022 14:23:51 -0400 Subject: [PATCH] feat: TNL-10051 blockstore API perf instrumentation Log before & after making blockstore (Django) API calls to get performance from timestamps --- openedx/core/lib/blockstore_api/methods.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/openedx/core/lib/blockstore_api/methods.py b/openedx/core/lib/blockstore_api/methods.py index 7d7c65decd..76a5097df0 100644 --- a/openedx/core/lib/blockstore_api/methods.py +++ b/openedx/core/lib/blockstore_api/methods.py @@ -33,7 +33,9 @@ from blockstore.apps.api.exceptions import ( import blockstore.apps.api.methods as blockstore_api_methods from .config import use_blockstore_app +import logging +log = logging.getLogger(__name__) def toggle_blockstore_api(func): """ @@ -44,7 +46,11 @@ def toggle_blockstore_api(func): def wrapper(*args, **kwargs): if use_blockstore_app(): return getattr(blockstore_api_methods, func.__name__)(*args, **kwargs) - return func(*args, **kwargs) + joined_args = " " + log.Info('blockstore ' + func.__name__ + ' API call called with ' + joined_args.join(args) + ' arguments') + ret_object = func(*args, **kwargs) + log.Info('blockstore ' + func.__name__ + ' API call is done') + return ret_object return wrapper