We need some tool for analyzing non view functions of our django project particularly the celery-beat tasks. So, is there any tool for profiling queries and latency of running ordinary functions (not views) in a django app? Preferably, is there any decorators (or any other mechanism) that can add results of profiling an ordinary function to the output of tools like django-silk or django-debug-toolbar?
At last, I used the silk middleware code and made a decorator for profiling random functions like requests then used it for profiling my tasks. This was somehow patchy but worked. The code is accessible here.