简体   繁体   English

剖析 django 中普通函数的数据库查询和延迟

[英]Profiling database queries and latency of ordinary functions in django

We need some tool for analyzing non view functions of our django project particularly the celery-beat tasks.我们需要一些工具来分析我们的 django 项目的非视图函数,尤其是 celery-beat 任务。 So, is there any tool for profiling queries and latency of running ordinary functions (not views) in a django app?那么,是否有任何工具可以分析 django 应用程序中运行普通功能(不是视图)的查询和延迟? 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?最好是,是否有任何装饰器(或任何其他机制)可以将普通 function 的分析结果添加到 django-silk 或 django-debug-toolbar 等工具的 output?

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.最后,我使用了 silk 中间件代码并制作了一个装饰器来分析请求等随机函数,然后用它来分析我的任务。 This was somehow patchy but worked.这在某种程度上是不完整的但有效。 The code is accessible here .代码可在此处访问。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM