# Buildsheet autogenerated by ravenadm tool -- Do not edit. NAMEBASE= python-django-prometheus VERSION= 2.4.1 KEYWORDS= python VARIANTS= v13 v14 SDESC[v13]= Django app monitor with Prometheus.io (3.13) SDESC[v14]= Django app monitor with Prometheus.io (3.14) HOMEPAGE= https://github.com/korfuri/django-prometheus CONTACT= Python_Automaton[python@ironwolf.systems] DOWNLOAD_GROUPS= main SITES[main]= PYPIWHL/01/50/9c5e022fa92574e5d20606687f15a2aa255e10512a17d11a8216fa117f72 DISTFILE[1]= django_prometheus-2.4.1-py2.py3-none-any.whl:main DIST_SUBDIR= python-src DF_INDEX= 1 SPKGS[v13]= single SPKGS[v14]= single OPTIONS_AVAILABLE= PY313 PY314 OPTIONS_STANDARD= none VOPTS[v13]= PY313=ON PY314=OFF VOPTS[v14]= PY313=OFF PY314=ON DISTNAME= django_prometheus-2.4.1.dist-info GENERATED= yes [PY313].RUN_DEPENDS_ON= python-Django:single:v13 python-prometheus-client:single:v13 [PY313].USES_ON= python:v13,wheel [PY314].RUN_DEPENDS_ON= python-Django:single:v14 python-prometheus-client:single:v14 [PY314].USES_ON= python:v14,wheel [FILE:2169:descriptions/desc.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) ## 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 >= 4.2 * Python 3.9 and above. ### 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: ```python PROMETHEUS_LATENCY_BUCKETS = (0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1.0, 2.5, 5.0, 7.5, 10.0, 25.0, 50.0, 75.0, float("inf"),) ``` You can define custom buckets for latency, adding more buckets decreases performance but increases accuracy: ```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")) ``` --- You can have a custom namespace for your metrics: ```python PROMETHEUS_METRIC_NAMESPACE = "project" ``` [FILE:134:distinfo] 7fe5af7f7c9ad9cd8a429fe0f3f1bf651f0e244f77162147869eab7ec09cc5e7 29541 python-src/django_prometheus-2.4.1-py2.py3-none-any.whl