def record_query(request: Request, timer: Timer, query_metadata: SnubaQueryMetadata) -> None: """ Records a request after it has been parsed and validated, whether we actually ran a query or not. """ if settings.RECORD_QUERIES: # Send to redis # We convert this to a dict before passing it to state in order to avoid a # circular dependency, where state would depend on the higher level # QueryMetadata class state.record_query(query_metadata.to_dict()) final = str(request.query.get_final()) referrer = request.referrer or "none" timer.send_metrics_to( metrics, tags={ "status": query_metadata.status.value, "referrer": referrer, "final": final, }, mark_tags={ "final": final, "referrer": referrer }, ) _add_tags(timer, request)
def record_query( request: Request, timer: Timer, query_metadata: SnubaQueryMetadata, extra_data: Mapping[str, Any], ) -> None: """ Records a request after it has been parsed and validated, whether we actually ran a query or not. """ if settings.RECORD_QUERIES: # Send to redis # We convert this to a dict before passing it to state in order to avoid a # circular dependency, where state would depend on the higher level # QueryMetadata class state.record_query(query_metadata.to_dict()) _record_timer_metrics(request, timer, query_metadata) _record_attribution_metrics(request, query_metadata, extra_data) _add_tags(timer, extra_data.get("experiments"), query_metadata)