async def wrapped_send(message): if message.get("type") == "http.response.start": await set_context( lambda: get_data_from_response(message, self.client.config, constants.TRANSACTION), "response") result = "HTTP {}xx".format(message["status"] // 100) elasticapm.set_transaction_result(result, override=False) await send(message)
async def _request_finished(self, response: Response): """Captures the end of the request processing to APM. Args: response (Response) """ await set_context( lambda: get_data_from_response(response, self.client.config, constants.TRANSACTION), "response") result = "HTTP {}xx".format(response.status_code // 100) elasticapm.set_transaction_result(result, override=False)