diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f3341b37e..07f59f368 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,7 @@ repos: language_version: python3 exclude: "(tests/utils/stacks/linenos.py|tests/utils/stacks/linenos2.py|tests/contrib/grpc/grpc_app/.*pb2.*.py)" - repo: https://github.com/PyCQA/flake8 - rev: 5.0.4 + rev: 6.1.0 hooks: - id: flake8 exclude: "(tests/utils/stacks/linenos.py|tests/utils/stacks/linenos2.py|tests/contrib/grpc/grpc_app/.*pb2.*.py)" diff --git a/elasticapm/contrib/asgi.py b/elasticapm/contrib/asgi.py index 701ea3d0e..096fed36a 100644 --- a/elasticapm/contrib/asgi.py +++ b/elasticapm/contrib/asgi.py @@ -92,13 +92,15 @@ async def __call__(self, scope: "Scope", receive: "ASGIReceiveCallable", send: " body = str(body_raw, errors="ignore") # Dispatch to the ASGI callable - async def wrapped_receive(): + async def new_wrapped_receive(): if messages: return messages.pop(0) # Once that's done we can just await any other messages. return await receive() + wrapped_receive = new_wrapped_receive + await set_context(lambda: self.get_data_from_request(scope, constants.TRANSACTION, body), "request") try: