* feat(chalice): upgraded dependencies * feat(chalice): changed path analysis schema * feat(DB): click coordinate support * feat(chalice): changed path analysis issues schema feat(chalice): upgraded dependencies * fix(chalice): fixed pydantic issue * refactor(chalice): refresh token validator * feat(chalice): role restrictions * feat(chalice): EE path analysis changes * refactor(DB): changed creation queries refactor(DB): changed delte queries feat(DB): support new path analysis payload * feat(chalice): save path analysis card * feat(chalice): restrict access * feat(chalice): restrict access * feat(chalice): EE save new path analysis card * refactor(chalice): path analysis * feat(chalice): path analysis new query * fix(chalice): configurable CH config * fix(chalice): assist autocomplete * refactor(chalice): refactored permissions * refactor(chalice): changed log level * refactor(chalice): upgraded dependencies * refactor(chalice): changed path analysis query * refactor(chalice): changed path analysis query * refactor(chalice): upgraded dependencies refactor(alerts): upgraded dependencies refactor(crons): upgraded dependencies * feat(chalice): path analysis ignore start point * feat(chalice): path analysis in progress * refactor(chalice): path analysis changed link sort * refactor(chalice): path analysis changed link sort * refactor(chalice): path analysis changed link sort * refactor(chalice): path analysis new query refactor(chalice): authorizers * refactor(chalice): refactored authorizer * fix(chalice): fixed create card of PathAnalysis * refactor(chalice): compute link-percentage for Path Analysis * refactor(chalice): remove null starting point from Path Analysis * feat(chalice): path analysis CH query * refactor(chalice): changed Path Analysis links-value fix(chalice): fixed search notes for EE * feat(chalice): path analysis enhanced query results * feat(chalice): include timezone in search sessions response * refactor(chalice): refactored logs * refactor(chalice): refactored logs feat(chalice): get path analysis issues
31 lines
1.3 KiB
Python
31 lines
1.3 KiB
Python
from functools import wraps
|
|
from time import time
|
|
import inspect
|
|
from chalicelib.utils import helper
|
|
import logging
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
def timed(f):
|
|
@wraps(f)
|
|
def wrapper(*args, **kwds):
|
|
if not helper.TRACK_TIME:
|
|
return f(*args, **kwds)
|
|
start = time()
|
|
result = f(*args, **kwds)
|
|
elapsed = time() - start
|
|
if inspect.stack()[1][3] == "_view_func":
|
|
logging.debug("%s: took %d s to finish" % (f.__name__, elapsed))
|
|
else:
|
|
call_stack = [i[3] for i in inspect.stack()[1:] if i[3] != "wrapper"]
|
|
call_stack = [c for c in call_stack if
|
|
c not in ['__init__', '__call__', 'finish_request', 'process_request_thread',
|
|
'handle_request', '_generic_handle', 'handle', '_bootstrap_inner', 'run',
|
|
'_bootstrap', '_main_rest_api_handler', '_user_handler',
|
|
'_get_view_function_response', 'wrapped_event', 'handle_one_request',
|
|
'_global_error_handler', 'openreplay_middleware']]
|
|
logger.debug("%s > %s took %d s to finish" % (" > ".join(call_stack), f.__name__, elapsed))
|
|
return result
|
|
|
|
return wrapper
|