Add support for exporting prometheus metrics
This commit is contained in:
parent
b51329eeeb
commit
d0b7a80077
@ -16,3 +16,4 @@ bleach==6.0.0
|
||||
requests==2.32.0
|
||||
xtarfile==0.1.0
|
||||
zstandard==0.17.0
|
||||
django-prometheus==2.3.1
|
||||
|
@ -6,6 +6,9 @@
|
||||
DEBUG = False
|
||||
DEBUG_TOOLBAR = False
|
||||
|
||||
# Export prometheus metrics
|
||||
PROMETHEUS_METRICS = False
|
||||
|
||||
# Notification admins
|
||||
ADMINS = ()
|
||||
|
||||
@ -265,4 +268,9 @@
|
||||
|
||||
INSTALLED_APPS = [*list(INSTALLED_APPS), 'debug_toolbar']
|
||||
|
||||
if PROMETHEUS_METRICS:
|
||||
MIDDLEWARE = ['django_prometheus.middleware.PrometheusBeforeMiddleware', *list(MIDDLEWARE), 'django_prometheus.middleware.PrometheusAfterMiddleware']
|
||||
|
||||
INSTALLED_APPS = [*list(INSTALLED_APPS), 'django_prometheus']
|
||||
|
||||
# vim: set ts=4 sw=4 et:
|
||||
|
6
urls.py
6
urls.py
@ -114,6 +114,12 @@
|
||||
path('__debug__/', include(debug_toolbar.urls)),
|
||||
])
|
||||
|
||||
# prometheus metrics
|
||||
if settings.PROMETHEUS_METRICS: # pragma :no cover
|
||||
urlpatterns.extend([
|
||||
path('', include('django_prometheus.urls')),
|
||||
])
|
||||
|
||||
|
||||
# displays all archweb urls
|
||||
def show_urls(urllist=urlpatterns, depth=0): # pragma: no cover
|
||||
|
Loading…
Reference in New Issue
Block a user