This commit is contained in:
michplunkett
2025-03-14 22:48:36 -05:00
parent a7a5b16ae6
commit 05e3755d65
2 changed files with 7 additions and 3 deletions

View File

@@ -26,7 +26,8 @@ def get_status(
try:
if task.status == "FAILURE":
# *FAILURE* The task raised an exception, or has exceeded the retry limit.
# The :attr:`result` attribute then contains the exception raised by the task.
# The :attr:`result` attribute then contains the exception raised by
# the task.
# https://docs.celeryq.dev/en/stable/_modules/celery/result.html#AsyncResult
raise task.result

View File

@@ -10,7 +10,8 @@ from app.web.utils.metrics import EXCEPTION_COUNTER
async def logging_middleware(request: Request, call_next):
try:
response = await call_next(request)
# TODO: use Origin to have summary prometheus metrics on where requests come from
# TODO: use Origin to have summary prometheus metrics on where
# requests come from
# origin = request.headers.get("origin")
logger.info(
f"{request.client.host}:{request.client.port} {request.method} {request.url._url} - HTTP {response.status_code}"
@@ -25,7 +26,9 @@ async def logging_middleware(request: Request, call_next):
raise e
async def increase_exceptions_counter(e: Exception, location: str = "cronjob"):
async def increase_exceptions_counter(
e: Exception, location: str = "cronjob"
) -> None:
if location == "cronjob":
try:
last_trace = traceback.extract_tb(e.__traceback__)[-1]