mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Closes #16010: Enable Prometheus middleware only if metrics are enabled
This commit is contained in:
@ -372,7 +372,6 @@ if not DJANGO_ADMIN_ENABLED:
|
||||
# Middleware
|
||||
MIDDLEWARE = [
|
||||
"strawberry_django.middlewares.debug_toolbar.DebugToolbarMiddleware",
|
||||
'django_prometheus.middleware.PrometheusBeforeMiddleware',
|
||||
'corsheaders.middleware.CorsMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.locale.LocaleMiddleware',
|
||||
@ -386,8 +385,14 @@ MIDDLEWARE = [
|
||||
'netbox.middleware.RemoteUserMiddleware',
|
||||
'netbox.middleware.CoreMiddleware',
|
||||
'netbox.middleware.MaintenanceModeMiddleware',
|
||||
'django_prometheus.middleware.PrometheusAfterMiddleware',
|
||||
]
|
||||
if METRICS_ENABLED:
|
||||
# If metrics are enabled, add the before & after Prometheus middleware
|
||||
MIDDLEWARE = [
|
||||
'django_prometheus.middleware.PrometheusBeforeMiddleware',
|
||||
*MIDDLEWARE,
|
||||
'django_prometheus.middleware.PrometheusAfterMiddleware',
|
||||
]
|
||||
|
||||
# URLs
|
||||
ROOT_URLCONF = 'netbox.urls'
|
||||
|
Reference in New Issue
Block a user