2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-02 03:30:54 +00:00

feat(backend): improve worker tracing (#9808)

* feat(backend): improve worker log

* refactor tracing details

* add tracing to gunicorn setup

* add sqlite tracing

* add system metrics

* instument wsgi

* make dbengine better accessible

* fix instruction

* instrument worker

* track task scheduling

* trace common tasks

* patch in support for django q

* trace various tasks

* add trcing for other dbs

* ignore coverage on tracing stuff

* more ignorance
This commit is contained in:
Matthias Mair
2025-06-20 01:47:28 +02:00
committed by GitHub
parent 00c974b629
commit 797b5f57b0
17 changed files with 258 additions and 47 deletions

View File

@ -40,3 +40,18 @@ max_requests_jitter = 50
# preload app so that the ready functions are only executed once
preload_app = True
def post_fork(server, worker):
"""Post-fork hook to set up logging for each worker."""
from django.conf import settings
if not settings.TRACING_ENABLED:
return
# Instrument gunicorm
from InvenTree.tracing import setup_instruments, setup_tracing
# Run tracing/logging instrumentation
setup_tracing(**settings.TRACING_DETAILS)
setup_instruments()