django processinfo是一个django应用程序,用于收集有关正在运行的服务器进程的信息。
django-processinfo的Python项目详细描述
一个可重用的django应用程序,用于收集有关正在运行的服务器进程的信息。 我们尽量减少额外的开销:django processinfo大多数时候只创建一个数据库查询来更新数据。
django processinfo将捕获的最重要数据:
过程统计:
- process PID, start time, life times
- Number of average/max living processes
- min/average/max response times
- Total request/exceptions count
内存统计:
- min/average/max memory usage (VmRSS, VmPeak)
系统信息:
- System memory usage
- Swap usage
- load average
django processinfo按站点id拆分这些数据中的一些,这样您就可以看到哪个站点最常用。
不是什么:
- 跟踪用户操作
- 收集apache.log中的信息
- 它不是源代码探查器(读取https://code.djangoproject.com/wiki/ProfilingDjango)
更多信息:https://www.python-forum.de/viewtopic.php?f=6&t=27168(de)
限制
只有当^ {STR 1 } $/PRO/$$/STATION/STATION存在时,这才有效。因此,只有在类似unix/linux的平台上。
待办事项
添加单元测试
安装
- 安装,例如:
pip install django-processinfo
- 添加设置(见下文)
- 创建表(运行syncdb)
设置
将此添加到您的设置中。py:
import os import django_processinfo INSTALLED_APPS = ( ... 'django_processinfo', ... ) MIDDLEWARE = ( 'django_processinfo.middlewares.ProcessInfoMiddleware', ... ) # Put templates above admin contrib, e.g.: TEMPLATE_DIRS = ( ... os.path.join(os.path.abspath(os.path.dirname(django_processinfo.__file__)), "templates/"), ... ) # include app settings from ./django_processinfo/app_settings.py from django_processinfo import app_settings as PROCESSINFO # Change settings like this: PROCESSINFO.ADD_INFO = True
processinfomiddleware
processinfomiddleware实际上可以插入任何位置。 然而,它应该被添加到远高于。因此,捕捉一切。
为了提高性能,可以将processinfomiddleware放在localsynccachemiddleware之后。 但是,在每次缓存命中时都缺少统计值!
应用程序设置
可在./django_processinfo/app_settings.py中找到可用的django processinfo设置
django兼容性
Version | Python | Django |
---|---|---|
v0.8.0 | python 3 | django v1.11 LTS |
v0.7.0 | python 2 | django v1.5 |
v0.6.1 | python 2 | django v1.4 |
历史记录
V0.8.0-09.03.2018-compare v0.7.1…master
- Updates for Python v3 and Django 1.11
V0.7.1-20.08.2015-compare v0.6.3…v0.7.1
- Changes for django 1.5 support
- change setup install_requires to Django v1.3.x - v1.5.x
- Bugfix in templates: missed i18n
2012年8月24日-5月6日
- remove auto commit date from version
V0.6.2
- Auto cleanup ProcessInfo table to protect against overloading.
- Don’t insert django-processinfo “time cost” info if response.status_code is not 200
V0.6.1
- Tested also with django v1.4
- change setup install_requires to Django v1.3.x - v1.4.x
0.6.0版
- Add “Reset all data” in object tools.
- Make “Remove dead PIDs” and “Reset all data” available on both admin pages.
第5.5.2版
第5.5.1版
- Add “Remove dead PIDs” as admin view in “Process statistics” object tools (top, right, grey links)
0.5.0版
- Model changes: Please recreate tables, e.g.: ^{tt1}$
- New: Display some static system informations (uname, domain name, ip adress, python version, sys.prefix)
- New: current living processes (also per site)
- display sum of user/system mode time
V0.4.1
- Bugfix for UnicodeEncodeError in setup: Use new solution, see: https://code.google.com/p/python-creole/wiki/UseInSetup
v0.4
- Bugfix with “Total created processes”
- Display “Process lifetime”
0.3.0版
- Display some system information from /proc/meminfo and ‘load average’
- Many Bugfixes
0.2.0版
- Many things changes! Recreate tables, e.g: ^{tt1}$
0.1.0版
- first Version
链接
GitHub | https://github.com/jedie/django-processinfo |
PyPi | http://pypi.python.org/pypi/django-processinfo |
接触
除了github的通信功能之外,还可以参与对话:
Forum | http://www.pylucid.org/en/forum/10/ |
IRC | #pylucid on freenode.net (Yes, the PyLucid channel…) |
webchat | http://webchat.freenode.net/?channels=pylucid |