Exemplo n.º 1
0
    def wrapper_func(*args, **kwargs):
        """
        The wrapper function that grabs analytics from REST calls
        """
        analytic = kwargs.copy()
        analytic['start_time'] = datetime.now().isoformat()
        result = func(*args, **kwargs)
        analytic['end_time'] = datetime.now().isoformat()

        analytic['response_size'] = len(result.content)
        analytic['func_call'] = func.__name__
        analytic['resource'] = list(args)[1:]
        analytics.write_json_analytics('network', analytic, size_limit=1024 * 1024)

        return result
Exemplo n.º 2
0
def log_analytics(**kwargs):
    """
    Passes on anything to be logged for analytics.
    """
    analytics.write_json_analytics(__name__, kwargs, result_limit=10)
Exemplo n.º 3
0
def log_analytics(**kwargs):
    """
    Passes on anything to be logged for analytics.
    """
    analytics.write_json_analytics(__name__, kwargs, size_limit=1024 * 1024)