10000 Setup Sentry for aiohttp as well (#475) · python/cpython@42dc07b · GitHub
[go: up one dir, main page]

Skip to content

Commit 42dc07b

Browse files
authored
Setup Sentry for aiohttp as well (#475)
1 parent e8a9ccf commit 42dc07b

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

miss_islington/__main__.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
from aiohttp import web
99
from gidgethub import aiohttp as gh_aiohttp
1010
from gidgethub import routing, sansio
11+
import sentry_sdk
12+
from sentry_sdk.integrations.aiohttp import AioHttpIntegration
13+
1114

1215
from . import backport_pr, check_run, delete_branch, status_change
1316

@@ -53,11 +56,11 @@ async def main(request):
5356
return web.Response(status=500)
5457

5558

56-
if __name__ == "__main__": # pragma: no cover
57-
app = web.Application()
58-
app.router.add_post("/", main)
59-
port = os.environ.get("PORT")
60-
if port is not None:
61-
port = int(port)
59+
sentry_sdk.init(dsn=os.environ.get("SENTRY_DSN"), integrations=[AioHttpIntegration()])
60+
app = web.Application()
61+
app.router.add_post("/", main)
62+
port = os.environ.get("PORT")
63+
if port is not None:
64+
port = int(port)
6265

63-
web.run_app(app, port=port)
66+
web.run_app(app, port=port)

0 commit comments

Comments
 (0)
0