From 2f012b49b7e18c1fd19d57ddf1cf5652376085d2 Mon Sep 17 00:00:00 2001 From: Julian Bez Date: Mon, 11 Dec 2023 17:05:42 +0000 Subject: [PATCH] fix: Remove django-statsd (#19255) Remove django-statsd --- posthog/middleware.py | 8 -------- posthog/settings/web.py | 6 ------ 2 files changed, 14 deletions(-) diff --git a/posthog/middleware.py b/posthog/middleware.py index c0fab1aec52a5..31a9e0e744f22 100644 --- a/posthog/middleware.py +++ b/posthog/middleware.py @@ -31,7 +31,6 @@ from posthog.models import Action, Cohort, Dashboard, FeatureFlag, Insight, Team, User from posthog.rate_limit import DecideRateThrottle from posthog.settings import SITE_URL, DEBUG -from posthog.settings.statsd import STATSD_HOST from posthog.user_permissions import UserPermissions from .auth import PersonalAPIKeyAuthentication from .utils_cors import cors_response @@ -369,13 +368,6 @@ def __init__(self, get_response): # List of middlewares we want to run, that would've been shortcircuited otherwise self.CAPTURE_MIDDLEWARE = middlewares - if STATSD_HOST is not None: - # import here to avoid log-spew about failure to connect to statsd, - # as this connection is created on import - from django_statsd.middleware import StatsdMiddlewareTimer - - self.CAPTURE_MIDDLEWARE.append(StatsdMiddlewareTimer(get_response=get_response)) - def __call__(self, request: HttpRequest): if request.path in ( "/e", diff --git a/posthog/settings/web.py b/posthog/settings/web.py index b846a2486c5df..36309548bb4a4 100644 --- a/posthog/settings/web.py +++ b/posthog/settings/web.py @@ -6,7 +6,6 @@ from corsheaders.defaults import default_headers from posthog.settings.base_variables import BASE_DIR, DEBUG, TEST -from posthog.settings.statsd import STATSD_HOST from posthog.settings.utils import get_from_env, get_list, str_to_bool from posthog.utils_cors import CORS_ALLOWED_TRACING_HEADERS @@ -107,11 +106,6 @@ "posthog.middleware.PostHogTokenCookieMiddleware", ] - -if STATSD_HOST is not None: - MIDDLEWARE.insert(0, "django_statsd.middleware.StatsdMiddleware") - MIDDLEWARE.append("django_statsd.middleware.StatsdMiddlewareTimer") - if DEBUG: # Used on local devenv to reverse-proxy all of /i/* to capture-rs on port 3000 INSTALLED_APPS.append("revproxy")