Merge pull request #30881 from openedx/bszabo/TNL-10051-instrument-blockstore-api

feat: TNL-10051 blockstore API perf instrumentation
This commit is contained in:
bszabo
2022-08-22 13:47:24 -04:00
committed by GitHub

View File

@@ -3,6 +3,7 @@ API Client methods for working with Blockstore bundles and drafts
"""
import base64
import logging
from functools import wraps
from urllib.parse import urlencode
from uuid import UUID
@@ -34,6 +35,8 @@ import blockstore.apps.api.methods as blockstore_api_methods
from .config import use_blockstore_app
log = logging.getLogger(__name__)
def toggle_blockstore_api(func):
"""
@@ -44,7 +47,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