asgi: ignore lifespan requests, remove healthcheck events from sentry
This commit is contained in:
parent
219e16f8e5
commit
bf4763d946
|
@ -5,7 +5,6 @@ import structlog
|
|||
|
||||
bind = "0.0.0.0:8000"
|
||||
workers = multiprocessing.cpu_count() * 2 + 1
|
||||
workers = 1
|
||||
|
||||
user = "passbook"
|
||||
group = "passbook"
|
||||
|
|
|
@ -4,6 +4,7 @@ from botocore.client import ClientError
|
|||
from django.core.exceptions import DisallowedHost, ValidationError
|
||||
from django.db import InternalError, OperationalError, ProgrammingError
|
||||
from django_redis.exceptions import ConnectionInterrupted
|
||||
from redis.exceptions import ConnectionError as RedisConnectionError
|
||||
from redis.exceptions import RedisError
|
||||
from rest_framework.exceptions import APIException
|
||||
from structlog import get_logger
|
||||
|
@ -24,6 +25,7 @@ def before_send(event, hint):
|
|||
ConnectionInterrupted,
|
||||
APIException,
|
||||
ConnectionResetError,
|
||||
RedisConnectionError,
|
||||
WorkerLostError,
|
||||
DisallowedHost,
|
||||
ConnectionResetError,
|
||||
|
|
|
@ -76,6 +76,10 @@ class ASGILogger:
|
|||
return
|
||||
|
||||
self.start = time()
|
||||
if scope["type"] == "lifespan":
|
||||
# https://code.djangoproject.com/ticket/31508
|
||||
# https://github.com/encode/uvicorn/issues/266
|
||||
return
|
||||
await self.app(scope, receive, self.send_hooked)
|
||||
|
||||
async def send_hooked(self, message: Message) -> None:
|
||||
|
@ -115,6 +119,6 @@ class ASGILogger:
|
|||
)
|
||||
|
||||
|
||||
application = SentryAsgiMiddleware(
|
||||
ASGILogger(guarantee_single_callable(get_default_application()))
|
||||
application = ASGILogger(
|
||||
guarantee_single_callable(SentryAsgiMiddleware(get_default_application()))
|
||||
)
|
||||
|
|
Reference in New Issue