def send_request(action, request, data): """ Passes to send, but pulls what we'd like out of the request before doing so. Use this from Django views. """ data['user-agent'] = request.META.get('HTTP_USER_AGENT') data['locale'] = request.LANG data['src'] = request.GET.get('src', '') record_stat(action, request, **data) send(action, data)
def record_action(action, request, data=None): """Records the given action by sending it to the metrics servers. Currently this is storing the data internally in the monolith temporary table. :param action: the action related to this request. :param request: the request that triggered this call. :param data: some optional additional data about this call. """ if data is None: data = {} data["user-agent"] = request.META.get("HTTP_USER_AGENT") data["locale"] = request.LANG data["src"] = request.GET.get("src", "") record_stat(action, request, **data)
def record_action(action, request, data=None): """Records the given action by sending it to the metrics servers. Currently this is storing the data internally in the monolith temporary table. :param action: the action related to this request. :param request: the request that triggered this call. :param data: some optional additional data about this call. """ if data is None: data = {} data['user-agent'] = request.META.get('HTTP_USER_AGENT') data['locale'] = request.LANG data['src'] = request.GET.get('src', '') record_stat(action, request, **data)