python-django-prometheus
Port variant py311
Summary Django app monitor with Prometheus.io (3.11)
Package version 2.2.0
Homepage https://github.com/korfuri/django-prometheus
Keywords python
Maintainer Python Automaton
License Not yet specified
Other variants py310
Ravenports Buildsheet | History
Ravensource Port Directory | History
Last modified 01 JAN 2023, 17:21:46 UTC
Port created 01 JAN 2023, 17:21:46 UTC
Subpackage Descriptions
single # django-prometheus Export Django monitoring metrics for Prometheus.io [![Join the chat at https://gitter.im/django-prometheus/community]](https://gitter.im/django-prometheus/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [PyPI version] [Build Status] [Coverage Status] [![PyPi page link -- Python versions]](https://pypi.python.org/pypi/django-prometheus) [![Code style: black]](https://github.com/psf/black) ## Features This library provides Prometheus metrics for Django related operations: * Requests & Responses * Database access done via [Django ORM] * Cache access done via [Django Cache framework] ## Usage ### Requirements * Django >= 2.2 ### Installation Install with: ```shell pip install django-prometheus ``` Or, if you're using a development version cloned from this repository: ```shell python path-to-where-you-cloned-django-prometheus/setup.py install ``` This will install [prometheus_client] as a dependency. ### Quickstart In your settings.py: ```python INSTALLED_APPS = [ ... 'django_prometheus', ... ] MIDDLEWARE = [ 'django_prometheus.middleware.PrometheusBeforeMiddleware', # All your other middlewares go here, including the default # middlewares like SessionMiddleware, CommonMiddleware, # CsrfViewmiddleware, SecurityMiddleware, etc. 'django_prometheus.middleware.PrometheusAfterMiddleware', ] ``` In your urls.py: ```python urlpatterns = [ ... path('', include('django_prometheus.urls')), ] ``` ### Configuration Prometheus uses Histogram based grouping for monitoring latencies. The default buckets are here: https://github.com/prometheus/client_python/blob/master/prometheus_client/core.py You can define custom buckets for latency, adding more buckets decreases performance but increases accuracy: https://prometheus.io/docs/practices/histograms/ ```python PROMETHEUS_LATENCY_BUCKETS = (.1, .2, .5, .6, .8, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.5, 9.0, 12.0, 15.0, 20.0, 30.0, float("inf")) ``` ### Monitoring your databases SQLite, MySQL, and PostgreSQL databases can be monitored. Just replace the `ENGINE` property of your database, replacing `django.db.backends` with `django_prometheus.db.backends`. ```python DATABASES = { 'default': { 'ENGINE': 'django_prometheus.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
Configuration Switches (platform-specific settings discarded)
PY310 OFF Build using Python 3.10 PY311 ON Build using Python 3.11
Package Dependencies by Type
Build (only) python-pip:single:py311
autoselect-python:single:standard
Build and Runtime python311:single:standard
Runtime (only) python-prometheus-client:single:py311
Download groups
main mirror://PYPIWHL/f3/26/dbf0111fb13540f35a93a201e1ec759cb7aeaa124665da9673ff51c86b7d
Distribution File Information
e6616770d8820b8834762764bf1b76ec08e1b98e72a6f359d488a2e15fe3537c 29020 django_prometheus-2.2.0-py2.py3-none-any.whl
Ports that require python-django-prometheus:py311
No other ports depend on this one.