added prometheus metrics exporter
This commit is contained in:
parent
b173068a76
commit
5cb6f87445
6 changed files with 51 additions and 1 deletions
|
@ -7,7 +7,6 @@ from contextlib import suppress
|
|||
from pathlib import Path
|
||||
from typing import Optional
|
||||
|
||||
import sass
|
||||
from django.contrib.messages import constants as messages
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.utils.crypto import get_random_string
|
||||
|
@ -394,6 +393,19 @@ with suppress(ImportError):
|
|||
import django_extensions # noqa
|
||||
INSTALLED_APPS.append('django_extensions')
|
||||
|
||||
METRCIS = config.getboolean('c3nav', 'metrics', fallback=False)
|
||||
if METRCIS:
|
||||
try:
|
||||
import django_prometheus # noqa
|
||||
INSTALLED_APPS.append('django_prometheus')
|
||||
MIDDLEWARE = [
|
||||
'django_prometheus.middleware.PrometheusBeforeMiddleware',
|
||||
*MIDDLEWARE,
|
||||
'django_prometheus.middleware.PrometheusAfterMiddleware',
|
||||
]
|
||||
except ImportError:
|
||||
METRCIS = False
|
||||
|
||||
# Security settings
|
||||
X_FRAME_OPTIONS = 'DENY'
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue