def request_hook(self, span: Span, request): """django request hook before request is processed by app""" try: body = request.body span.update_name(f"{request.method} {span.name}") self.generic_request_handler(request.headers, body, span) full_url = request.build_absolute_uri() block_result = Registry().apply_filters(span, full_url, request.headers, body, TYPE_HTTP) if block_result: logger.debug('should block evaluated to true, aborting with 403') # since middleware chain is halted the status code is not set when blocked span.set_attribute('http.status_code', 403) span.end() raise PermissionDenied except PermissionDenied as permission_denied: raise permission_denied except Exception as err: # pylint:disable=W0703 logger.debug(constants.INST_RUNTIME_EXCEPTION_MSSG, 'django request hook', err, traceback.format_exc())
def request_hook(span: Span, params: aiohttp.TraceRequestStartParams): span.update_name(f"{params.method} - {params.url.path}")
def request_hook(span: Span, params: aiohttp.TraceRequestStartParams): span.update_name("{} - {}".format(params.method, params.url.path))