Skip to content

Commit e8a9ccf

Browse files
authored
Setup Sentry in the Celery worker (#474)
1 parent 3188208 commit e8a9ccf

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

miss_islington/__main__.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55

66
import aiohttp
77
import cachetools
8-
import sentry_sdk
98
from aiohttp import web
10-
from sentry_sdk.integrations.celery import CeleryIntegration
119
from gidgethub import aiohttp as gh_aiohttp
1210
from gidgethub import routing, sansio
1311

@@ -20,9 +18,6 @@
2018
cache = cachetools.LRUCache(maxsize=500)
2119

2220

23-
sentry_sdk.init(os.environ.get("SENTRY_DSN"), integrations=[CeleryIntegration()])
24-
25-
2621
async def main(request):
2722
try:
2823
body = await request.read()

miss_islington/tasks.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
import celery
21
import asyncio
32
import os
43
import subprocess
5-
import aiohttp
6-
from gidgethub import aiohttp as gh_aiohttp
74

5+
import aiohttp
86
import cachetools
9-
10-
from celery import bootsteps
11-
7+
import celery
128
from cherry_picker import cherry_picker
9+
from celery import bootsteps
10+
from gidgethub import aiohttp as gh_aiohttp
11+
import sentry_sdk
12+
from sentry_sdk.integrations.celery import CeleryIntegration
1313

1414
from . import util
1515

16+
1617
app = celery.Celery("backport_cpython")
1718

1819
app.conf.update(
@@ -21,6 +22,8 @@
2122
)
2223

2324
cache = cachetools.LRUCache(maxsize=500)
25+
sentry_sdk.init(os.environ.get("SENTRY_DSN"), integrations=[CeleryIntegration()])
26+
2427

2528
CHERRY_PICKER_CONFIG = {
2629
"team": "python",

0 commit comments

Comments
 (0)