We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Half installed AioHttpIntegration causes aiohttp to crash
If I call:
```python
sentry_sdk.integrations.setup_integrations(
        [sentry_sdk.integrations.aiohttp.AioHttpIntegration()])
```
after `sentry_sdk.init()` the `_handle` method of `aiohttp.web.Application` gets replaced but the integration does not get registered in the client. This causes the replaced `_handle` ro run into a codepath where there as a `await` missing. This gives an exception in every request:
```
ERROR:aiohttp.server:Unhandled exception                                                                                                                                                                                                                             
Traceback (most recent call last):                                                                                                                            
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 447, in start                                                                                                                                                                          
    await resp.prepare(request)                                                                                                                               
AttributeError: 'coroutine' object has no attribute 'prepare'                                                                                                                                                                                                        
/usr/local/lib/python3.7/site-packages/xxx/base.py:151: RuntimeWarning: coroutine 'Application._handle' was never awaited                              
  self._loop.run_forever()     
```

This will not get logged to sentry at all, because the `aiohttp.server` logger gets ignored by (half-)installing the integration (see #259).

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `sentry_sdk/integrations/aiohttp.py`
Content:
```
1 import sys
2 import weakref
3 
4 from sentry_sdk._compat import reraise
5 from sentry_sdk.hub import Hub
6 from sentry_sdk.integrations import Integration
7 from sentry_sdk.integrations.logging import ignore_logger
8 from sentry_sdk.integrations._wsgi_common import _filter_headers
9 from sentry_sdk.utils import capture_internal_exceptions, event_from_exception
10 
11 import asyncio
12 from aiohttp.web import Application, HTTPException
13 
14 
15 class AioHttpIntegration(Integration):
16     identifier = "aiohttp"
17 
18     @staticmethod
19     def setup_once():
20         if sys.version_info < (3, 7):
21             # We better have contextvars or we're going to leak state between
22             # requests.
23             raise RuntimeError(
24                 "The aiohttp integration for Sentry requires Python 3.7+"
25             )
26 
27         ignore_logger("aiohttp.server")
28 
29         old_handle = Application._handle
30 
31         async def sentry_app_handle(self, request, *args, **kwargs):
32             async def inner():
33                 hub = Hub.current
34                 if hub.get_integration(AioHttpIntegration) is None:
35                     return old_handle(self, request, *args, **kwargs)
36 
37                 weak_request = weakref.ref(request)
38 
39                 with Hub(Hub.current) as hub:
40                     with hub.configure_scope() as scope:
41                         scope.add_event_processor(_make_request_processor(weak_request))
42 
43                     try:
44                         response = await old_handle(self, request)
45                     except HTTPException:
46                         raise
47                     except Exception:
48                         reraise(*_capture_exception(hub))
49 
50                     return response
51 
52             return await asyncio.create_task(inner())
53 
54         Application._handle = sentry_app_handle
55 
56 
57 def _make_request_processor(weak_request):
58     def aiohttp_processor(event, hint):
59         request = weak_request()
60         if request is None:
61             return event
62 
63         with capture_internal_exceptions():
64             # TODO: Figure out what to do with request body. Methods on request
65             # are async, but event processors are not.
66 
67             request_info = event.setdefault("request", {})
68 
69             request_info["url"] = "%s://%s%s" % (
70                 request.scheme,
71                 request.host,
72                 request.path,
73             )
74 
75             request_info["query_string"] = request.query_string
76             request_info["method"] = request.method
77             request_info["env"] = {"REMOTE_ADDR": request.remote}
78             request_info["headers"] = _filter_headers(dict(request.headers))
79 
80         return event
81 
82     return aiohttp_processor
83 
84 
85 def _capture_exception(hub):
86     exc_info = sys.exc_info()
87     event, hint = event_from_exception(
88         exc_info,
89         client_options=hub.client.options,
90         mechanism={"type": "aiohttp", "handled": False},
91     )
92     hub.capture_event(event, hint=hint)
93     return exc_info
94
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/sentry_sdk/integrations/aiohttp.py b/sentry_sdk/integrations/aiohttp.py
--- a/sentry_sdk/integrations/aiohttp.py
+++ b/sentry_sdk/integrations/aiohttp.py
@@ -32,7 +32,7 @@
             async def inner():
                 hub = Hub.current
                 if hub.get_integration(AioHttpIntegration) is None:
-                    return old_handle(self, request, *args, **kwargs)
+                    return await old_handle(self, request, *args, **kwargs)
 
                 weak_request = weakref.ref(request)

{"golden_diff": "diff --git a/sentry_sdk/integrations/aiohttp.py b/sentry_sdk/integrations/aiohttp.py\n--- a/sentry_sdk/integrations/aiohttp.py\n+++ b/sentry_sdk/integrations/aiohttp.py\n@@ -32,7 +32,7 @@\n             async def inner():\n                 hub = Hub.current\n                 if hub.get_integration(AioHttpIntegration) is None:\n-                    return old_handle(self, request, *args, **kwargs)\n+                    return await old_handle(self, request, *args, **kwargs)\n \n                 weak_request = weakref.ref(request)\n", "issue": "Half installed AioHttpIntegration causes aiohttp to crash\nIf I call:\r\n```python\r\nsentry_sdk.integrations.setup_integrations(\r\n        [sentry_sdk.integrations.aiohttp.AioHttpIntegration()])\r\n```\r\nafter `sentry_sdk.init()` the `_handle` method of `aiohttp.web.Application` gets replaced but the integration does not get registered in the client. This causes the replaced `_handle` ro run into a codepath where there as a `await` missing. This gives an exception in every request:\r\n```\r\nERROR:aiohttp.server:Unhandled exception                                                                                                                                                                                                                             \r\nTraceback (most recent call last):                                                                                                                            \r\n  File \"/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py\", line 447, in start                                                                                                                                                                          \r\n    await resp.prepare(request)                                                                                                                               \r\nAttributeError: 'coroutine' object has no attribute 'prepare'                                                                                                                                                                                                        \r\n/usr/local/lib/python3.7/site-packages/xxx/base.py:151: RuntimeWarning: coroutine 'Application._handle' was never awaited                              \r\n  self._loop.run_forever()     \r\n```\r\n\r\nThis will not get logged to sentry at all, because the `aiohttp.server` logger gets ignored by (half-)installing the integration (see #259).\n", "before_files": [{"content": "import sys\nimport weakref\n\nfrom sentry_sdk._compat import reraise\nfrom sentry_sdk.hub import Hub\nfrom sentry_sdk.integrations import Integration\nfrom sentry_sdk.integrations.logging import ignore_logger\nfrom sentry_sdk.integrations._wsgi_common import _filter_headers\nfrom sentry_sdk.utils import capture_internal_exceptions, event_from_exception\n\nimport asyncio\nfrom aiohttp.web import Application, HTTPException\n\n\nclass AioHttpIntegration(Integration):\n    identifier = \"aiohttp\"\n\n    @staticmethod\n    def setup_once():\n        if sys.version_info < (3, 7):\n            # We better have contextvars or we're going to leak state between\n            # requests.\n            raise RuntimeError(\n                \"The aiohttp integration for Sentry requires Python 3.7+\"\n            )\n\n        ignore_logger(\"aiohttp.server\")\n\n        old_handle = Application._handle\n\n        async def sentry_app_handle(self, request, *args, **kwargs):\n            async def inner():\n                hub = Hub.current\n                if hub.get_integration(AioHttpIntegration) is None:\n                    return old_handle(self, request, *args, **kwargs)\n\n                weak_request = weakref.ref(request)\n\n                with Hub(Hub.current) as hub:\n                    with hub.configure_scope() as scope:\n                        scope.add_event_processor(_make_request_processor(weak_request))\n\n                    try:\n                        response = await old_handle(self, request)\n                    except HTTPException:\n                        raise\n                    except Exception:\n                        reraise(*_capture_exception(hub))\n\n                    return response\n\n            return await asyncio.create_task(inner())\n\n        Application._handle = sentry_app_handle\n\n\ndef _make_request_processor(weak_request):\n    def aiohttp_processor(event, hint):\n        request = weak_request()\n        if request is None:\n            return event\n\n        with capture_internal_exceptions():\n            # TODO: Figure out what to do with request body. Methods on request\n            # are async, but event processors are not.\n\n            request_info = event.setdefault(\"request\", {})\n\n            request_info[\"url\"] = \"%s://%s%s\" % (\n                request.scheme,\n                request.host,\n                request.path,\n            )\n\n            request_info[\"query_string\"] = request.query_string\n            request_info[\"method\"] = request.method\n            request_info[\"env\"] = {\"REMOTE_ADDR\": request.remote}\n            request_info[\"headers\"] = _filter_headers(dict(request.headers))\n\n        return event\n\n    return aiohttp_processor\n\n\ndef _capture_exception(hub):\n    exc_info = sys.exc_info()\n    event, hint = event_from_exception(\n        exc_info,\n        client_options=hub.client.options,\n        mechanism={\"type\": \"aiohttp\", \"handled\": False},\n    )\n    hub.capture_event(event, hint=hint)\n    return exc_info\n", "path": "sentry_sdk/integrations/aiohttp.py"}], "after_files": [{"content": "import sys\nimport weakref\n\nfrom sentry_sdk._compat import reraise\nfrom sentry_sdk.hub import Hub\nfrom sentry_sdk.integrations import Integration\nfrom sentry_sdk.integrations.logging import ignore_logger\nfrom sentry_sdk.integrations._wsgi_common import _filter_headers\nfrom sentry_sdk.utils import capture_internal_exceptions, event_from_exception\n\nimport asyncio\nfrom aiohttp.web import Application, HTTPException\n\n\nclass AioHttpIntegration(Integration):\n    identifier = \"aiohttp\"\n\n    @staticmethod\n    def setup_once():\n        if sys.version_info < (3, 7):\n            # We better have contextvars or we're going to leak state between\n            # requests.\n            raise RuntimeError(\n                \"The aiohttp integration for Sentry requires Python 3.7+\"\n            )\n\n        ignore_logger(\"aiohttp.server\")\n\n        old_handle = Application._handle\n\n        async def sentry_app_handle(self, request, *args, **kwargs):\n            async def inner():\n                hub = Hub.current\n                if hub.get_integration(AioHttpIntegration) is None:\n                    return await old_handle(self, request, *args, **kwargs)\n\n                weak_request = weakref.ref(request)\n\n                with Hub(Hub.current) as hub:\n                    with hub.configure_scope() as scope:\n                        scope.add_event_processor(_make_request_processor(weak_request))\n\n                    try:\n                        response = await old_handle(self, request)\n                    except HTTPException:\n                        raise\n                    except Exception:\n                        reraise(*_capture_exception(hub))\n\n                    return response\n\n            return await asyncio.create_task(inner())\n\n        Application._handle = sentry_app_handle\n\n\ndef _make_request_processor(weak_request):\n    def aiohttp_processor(event, hint):\n        request = weak_request()\n        if request is None:\n            return event\n\n        with capture_internal_exceptions():\n            # TODO: Figure out what to do with request body. Methods on request\n            # are async, but event processors are not.\n\n            request_info = event.setdefault(\"request\", {})\n\n            request_info[\"url\"] = \"%s://%s%s\" % (\n                request.scheme,\n                request.host,\n                request.path,\n            )\n\n            request_info[\"query_string\"] = request.query_string\n            request_info[\"method\"] = request.method\n            request_info[\"env\"] = {\"REMOTE_ADDR\": request.remote}\n            request_info[\"headers\"] = _filter_headers(dict(request.headers))\n\n        return event\n\n    return aiohttp_processor\n\n\ndef _capture_exception(hub):\n    exc_info = sys.exc_info()\n    event, hint = event_from_exception(\n        exc_info,\n        client_options=hub.client.options,\n        mechanism={\"type\": \"aiohttp\", \"handled\": False},\n    )\n    hub.capture_event(event, hint=hint)\n    return exc_info\n", "path": "sentry_sdk/integrations/aiohttp.py"}]}