0

As of this week we are running our stack using python 3, django 2 and django channels 2. As this is an ASGI application we use a daphne server to handle both HTTP and websocket requests.

So far we are really happy with the overall performance and stability. In sentry, however, some errors appear to show mixed tracebacks from different requests.

As I understand correctly this might be because

synchronous views ought to run within a threadpool executor

My question really is, what is the correct way to aggregate logging to towards sentry in an ASGI application? I found this library by tomchristie, creator of starlette. Does anyone have experience using it in a django context?

specs:

raven==6.9.0
daphne==2.2.2
Django==2.1.1
channels==2.1.3

logging setup:

...
'handlers': {
    'sentry': {
        'level': sentry_level,
        'class': 'raven.contrib.django.handlers.SentryHandler',
        },
    },
....
LarsVegas
  • 6,522
  • 10
  • 43
  • 67
  • 1
    I am not familiar with ASGI in Django, but I can tell you two things upfront: 1.) you are using raven ("the old Python SDK") but your links are referencing sentry-sdk's issue tracker ("the new Python SDK"). I would use the new Python SDK 2.) using tomchristie's middleware will likely solve your problem (it is written for the new SDK) – Markus Unterwaditzer Dec 01 '18 at 10:04
  • @MarkusUnterwaditzer thanks for the helpful comment. We will give this a try. – LarsVegas Dec 03 '18 at 08:49

0 Answers0