Skip to main content

Django application to collect information about the running server processes.

Project description

A reuseable Django application for collecing information about the running server processes. We try to cause as little additional overhead: django-processinfo creates most of the time only one database query to update the data.

The most important data that django-processinfo will be captured:

  • Process statistics:

    • process PID, start time, life times

    • Number of average/max living processes

    • min/average/max response times

    • Total request/exceptions count

  • Memory statistics:

    • min/average/max memory usage (VmRSS, VmPeak)

  • System informations:

    • System memory usage

    • Swap usage

    • load average

django-processinfo splits some of these data per SITE_ID, so you can see e.g. which site is mostly used.

What is it not:

more info: https://www.python-forum.de/viewtopic.php?f=6&t=27168 (de)

limitation

This only works, if /proc/$$/status exists. So only on unix/linux like platforms, yet.

TODO

Add unittests

screenshots

Here some screenshots (from v0.2 - 19.08.2011) how it looks like:


Screenshot 1


Screenshot 2

install

  1. install it e.g.:

pip install django-processinfo
  1. add settings (see below)

  2. create tables (run syncdb)

settings

add this to your settings.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

The ProcessInfoMiddleware can actually be inserted anywhere. However, it should be added far above. Thus, to capture everything.

For performance enhancement, you can put ProcessInfoMiddleware after LocalSyncCacheMiddleware. But then, however, lacks statistical values on every cache hit!

app settings

Available django-processinfo settings can you found in ./django_processinfo/app_settings.py

developer info

e.g.:

~$ git clone https://github.com/jedie/django-processinfo.git
~$ cd django-processinfo
~/django-processinfo$ make
help                 List all commands
install-poetry       install or update poetry
install              install PyInventory via poetry
update               update the sources and installation
lint                 Run code formatters and linter
fix-code-style       Fix code formatting
tox-listenvs         List all tox test environments
tox                  Run pytest via tox with all environments
tox-py36             Run pytest via tox with *python v3.6*
tox-py37             Run pytest via tox with *python v3.7*
tox-py38             Run pytest via tox with *python v3.8*
pytest               Run pytest
update-rst-readme    update README.rst from README.creole
publish              Release new version to PyPi
run-dev-server       Run the django dev server in endless loop.

run test project

There exists a test project that can be easy run localy using the django dev. server and SQLite database. To run this project, do this:

~/django-processinfo$ make run-dev-server

You must also setup a test user, call this:

~/django-processinfo$ ./manage.sh createsuperuser

Django compatibility

Version

Python

Django

v0.9.0

python 3

django v2.2 LTS

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

history

  • dev - compare v1.0.2…master

    • TBC

  • v1.0.2 - 09.12.2020 - compare v1.0.1…v1.0.2

    • Bugfix “DataError: smallint out of range” on bigger PID numbers

  • v1.0.1 - 2.11.2020 - compare v1.0.0…v1.0.1

    • Bugfix injected footer

    • Fix/cleanup change list

    • Bugfix test project manage.sh

    • cleanup test project

  • v1.0.0 - 1.11.2020 - compare v0.9.0…v1.0.0

    • modernize project setup using poetry

    • Add a test project

    • Add tests

    • upgrade code style

  • v0.9.0 - 26.02.2020 - compare v0.8.0…v0.9.0

    • Updates for Django 2.2

  • v0.8.0 - 09.03.2018 - compare v0.7.1…v0.8.0

    • 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

  • v0.6.3 - 24.08.2012

    • 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

  • v0.6.0

    • Add “Reset all data” in object tools.

    • Make “Remove dead PIDs” and “Reset all data” available on both admin pages.

  • v0.5.2

  • v0.5.1

    • Add “Remove dead PIDs” as admin view in “Process statistics” object tools (top, right, grey links)

  • v0.5.0

    • Model changes: Please recreate tables, e.g.: ./manage.py reset django_processinfo

    • 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

  • v0.4

    • Bugfix with “Total created processes”

    • Display “Process lifetime”

  • v0.3.0

    • Display some system information from /proc/meminfo and ‘load average’

    • Many Bugfixes

  • v0.2.0

    • Many things changes! Recreate tables, e.g: ./manage.py reset django_processinfo

  • v0.1.0

    • first Version

Donation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-processinfo-1.0.2.tar.gz (24.0 kB view details)

Uploaded Source

Built Distribution

django_processinfo-1.0.2-py3-none-any.whl (30.3 kB view details)

Uploaded Python 3

File details

Details for the file django-processinfo-1.0.2.tar.gz.

File metadata

  • Download URL: django-processinfo-1.0.2.tar.gz
  • Upload date:
  • Size: 24.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.2.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5

File hashes

Hashes for django-processinfo-1.0.2.tar.gz
Algorithm Hash digest
SHA256 3cacad233a5428a5cc6292eafbfddd97948d8d1e4f47e47175a7fcdfcee90f12
MD5 28f21ecbf79ab635e59f76383d72f2b8
BLAKE2b-256 22d1d3da7de92780c9fda1d9d3732d16c70814d46a49502e7bf9ce54f5b9fb84

See more details on using hashes here.

Provenance

File details

Details for the file django_processinfo-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: django_processinfo-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 30.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.2.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5

File hashes

Hashes for django_processinfo-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 08aefdf7285d1eaa595e46570bcc12f2dfd9e24594d524246110614819076b6c
MD5 1fd2ff49d877bac37547722006ce0294
BLAKE2b-256 363efcb829c569d9b6c49c09dab32095595ff4e1ee127922300fab65f6751cf1

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page