From e800bbab151ca9c723ca02ecaeadc9da4e9a4959 Mon Sep 17 00:00:00 2001 From: Egor fureunoir Gorbunov Date: Thu, 5 Jun 2025 16:02:32 +0300 Subject: [PATCH] Features: Prometheus addons --- evibes/api_urls.py | 2 +- evibes/b2b_urls.py | 2 +- evibes/settings/base.py | 2 +- evibes/settings/caches.py | 2 +- evibes/settings/database.py | 2 +- pyproject.toml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/evibes/api_urls.py b/evibes/api_urls.py index fd1efce7..7d800448 100644 --- a/evibes/api_urls.py +++ b/evibes/api_urls.py @@ -11,7 +11,7 @@ from core.views import CustomGraphQLView, CustomRedocView, CustomSwaggerView, fa from evibes.settings import SPECTACULAR_PLATFORM_SETTINGS urlpatterns = [ - path('', include('django_prometheus.urls')), + path('prometheus/', include('django_prometheus.urls')), path(r"graphql/", csrf_exempt(CustomGraphQLView.as_view(graphiql=True, schema=schema))), path( r"docs/", diff --git a/evibes/b2b_urls.py b/evibes/b2b_urls.py index cebeda18..9aa49002 100644 --- a/evibes/b2b_urls.py +++ b/evibes/b2b_urls.py @@ -8,7 +8,7 @@ from evibes.settings import SPECTACULAR_B2B_SETTINGS urlpatterns = [ # path(r'graphql/', csrf_exempt(CustomGraphQLView.as_view(graphiql=True, schema=schema))), - path('', include('django_prometheus.urls')), + path('prometheus/', include('django_prometheus.urls')), path( r"docs/", SpectacularAPIView.as_view(urlconf="evibes.b2b_urls", custom_settings=SPECTACULAR_B2B_SETTINGS), diff --git a/evibes/settings/base.py b/evibes/settings/base.py index 082da02a..9a611b70 100644 --- a/evibes/settings/base.py +++ b/evibes/settings/base.py @@ -113,6 +113,7 @@ MIDDLEWARE = [ "evibes.middleware.CustomLocaleMiddleware", "django_hosts.middleware.HostsResponseMiddleware", "djangorestframework_camel_case.middleware.CamelCaseMiddleWare", + "django_prometheus.middleware.PrometheusAfterMiddleware" ] TEMPLATES = [ @@ -290,7 +291,6 @@ if getenv("SENTRY_DSN"): from sentry_sdk.integrations.redis import RedisIntegration ignore_errors = [ - "flower.views.error.NotFoundErrorHandler", "django.http.response.Http404", "django.core.exceptions.PermissionDenied", "django.core.exceptions.BadRequest", diff --git a/evibes/settings/caches.py b/evibes/settings/caches.py index 81b25f40..f9e10d00 100644 --- a/evibes/settings/caches.py +++ b/evibes/settings/caches.py @@ -4,7 +4,7 @@ from evibes.settings.base import REDIS_PASSWORD, getenv CACHES = { "default": { - "BACKEND": "django_redis.cache.RedisCache", + "BACKEND": "django_prometheus.cache.backends.redis", "LOCATION": getenv("CELERY_BROKER_URL", f"redis://:{REDIS_PASSWORD}@redis:6379/0"), "OPTIONS": { "CLIENT_CLASS": "django_redis.client.DefaultClient", diff --git a/evibes/settings/database.py b/evibes/settings/database.py index da0b2ac3..3036c70c 100644 --- a/evibes/settings/database.py +++ b/evibes/settings/database.py @@ -2,7 +2,7 @@ from evibes.settings.base import * # noqa: F403 DATABASES = { "default": { - "ENGINE": "django.contrib.gis.db.backends.postgis", + "ENGINE": "django_prometheus.db.backends.postgis", "NAME": getenv("POSTGRES_DB"), # noqa: F405 "USER": getenv("POSTGRES_USER"), # noqa: F405 "PASSWORD": getenv("POSTGRES_PASSWORD"), # noqa: F405 diff --git a/pyproject.toml b/pyproject.toml index 14318c58..af432e0b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ six = "1.17.0" cryptography = "44.0.3" redis = "6.0.0" httpx = "0.28.1" -celery = { extras = ["flower"], version = "5.5.2", optional = true } +celery = { version = "5.5.2", optional = true } pillow = "11.2.1" south = "1.0.2" pygraphviz = { version = "1.14", optional = true }