Add simple django metrics #77

Merged
j3d1 merged 1 commit from wip/lagertonne/metrics into testing 2024-11-08 16:54:03 +00:00
3 changed files with 8 additions and 0 deletions
Showing only changes of commit 269f02c2ce - Show all commits

View file

@ -50,6 +50,7 @@ INSTALLED_APPS = [
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'django_extensions', 'django_extensions',
'django_prometheus',
'rest_framework', 'rest_framework',
'knox', 'knox',
'drf_yasg', 'drf_yasg',
@ -85,6 +86,7 @@ SWAGGER_SETTINGS = {
} }
MIDDLEWARE = [ MIDDLEWARE = [
'django_prometheus.middleware.PrometheusBeforeMiddleware',
'django.middleware.security.SecurityMiddleware', 'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware', 'django.middleware.common.CommonMiddleware',
@ -92,6 +94,7 @@ MIDDLEWARE = [
'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware', 'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django_prometheus.middleware.PrometheusAfterMiddleware',
] ]
ROOT_URLCONF = 'core.urls' ROOT_URLCONF = 'core.urls'
@ -210,4 +213,6 @@ CHANNEL_LAYERS = {
} }
PROMETHEUS_METRIC_NAMESPACE = 'c3lf'
TEST_RUNNER = 'core.test_runner.FastTestRunner' TEST_RUNNER = 'core.test_runner.FastTestRunner'

View file

@ -32,4 +32,5 @@ urlpatterns = [
path('api/2/', include('notify_sessions.api_v2')), path('api/2/', include('notify_sessions.api_v2')),
path('api/2/', include('authentication.api_v2')), path('api/2/', include('authentication.api_v2')),
path('api/', get_info), path('api/', get_info),
path('', include('django_prometheus.urls')),
] ]

View file

@ -41,3 +41,5 @@ urllib3==2.1.0
uvicorn==0.24.0.post1 uvicorn==0.24.0.post1
watchfiles==0.21.0 watchfiles==0.21.0
websockets==12.0 websockets==12.0
django-prometheus==2.3.1
prometheus_client==0.21.0