Skip to content

Commit 0872a06

Browse files
committed
feat: integrate django-prometheus for web serivce metrics
1 parent c1ee33b commit 0872a06

3 files changed

Lines changed: 5 additions & 0 deletions

File tree

nix/overlay.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ in
8080
django-pghistory
8181
django-pglock
8282
django-pgtrigger
83+
django-prometheus
8384
pytest
8485
pytest-django
8586
pytest-playwright

src/project/settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ class AppSettings(BaseModel):
356356
"django.contrib.sessions",
357357
"django.contrib.messages",
358358
"django.contrib.staticfiles",
359+
"django_prometheus",
359360
"django_filters",
360361
"debug_toolbar",
361362
# AllAuth config
@@ -379,6 +380,7 @@ class AppSettings(BaseModel):
379380
]
380381

381382
MIDDLEWARE = [
383+
"django_prometheus.middleware.PrometheusBeforeMiddleware",
382384
"django.middleware.security.SecurityMiddleware",
383385
"django.contrib.sessions.middleware.SessionMiddleware",
384386
"django.middleware.common.CommonMiddleware",
@@ -390,6 +392,7 @@ class AppSettings(BaseModel):
390392
# Allauth account middleware
391393
"allauth.account.middleware.AccountMiddleware",
392394
"pghistory.middleware.HistoryMiddleware",
395+
"django_prometheus.middleware.PrometheusAfterMiddleware",
393396
]
394397

395398
ROOT_URLCONF = "project.urls"

src/project/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from django.urls import include, path
2020

2121
urlpatterns = [
22+
path("", include("django_prometheus.urls")),
2223
path("", include("webview.urls")),
2324
path("api/", include("api.urls")),
2425
path("feeds/", include("feeds.urls")),

0 commit comments

Comments
 (0)