Skip to content

armgit / meet

Public Imported from GitHub
0

Open source video conferencing app powered by LiveKit. Built with Django and React.

✨(backend) monitor throttling rate failure through sentry

lebaudantoine6742f5d19d9a
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 35ea3c37..312896ea 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,10 @@ and this project adheres to
## [Unreleased]
+### Added
+
+- ✨(backend) monitor throttling rate failure through sentry #964
+
### Changed
- ♿️(frontend) improve spinner reduced‑motion fallback #931
diff --git a/src/backend/core/api/throttling.py b/src/backend/core/api/throttling.py
index 2738bfc8..b6ec0c72 100644
--- a/src/backend/core/api/throttling.py
+++ b/src/backend/core/api/throttling.py
@@ -1,14 +1,26 @@
"""Throttling modules for the API."""
-from rest_framework import throttling
+from lasuite.drf.throttling import MonitoredThrottleMixin
+from rest_framework.throttling import AnonRateThrottle
+from sentry_sdk import capture_message
-class RequestEntryAnonRateThrottle(throttling.AnonRateThrottle):
+
+def sentry_monitoring_throttle_failure(message):
+ """Log when a failure occurs to detect rate limiting issues."""
+ capture_message(message, "warning")
+
+
+class MonitoredAnonRateThrottle(MonitoredThrottleMixin, AnonRateThrottle):
+ """Throttle for the monitored scoped rate throttle."""
+
+
+class RequestEntryAnonRateThrottle(MonitoredAnonRateThrottle):
"""Throttle Anonymous user requesting room entry"""
scope = "request_entry"
-class CreationCallbackAnonRateThrottle(throttling.AnonRateThrottle):
+class CreationCallbackAnonRateThrottle(MonitoredAnonRateThrottle):
"""Throttle Anonymous user requesting room generation callback"""
scope = "creation_callback"
diff --git a/src/backend/meet/settings.py b/src/backend/meet/settings.py
index b5044620..636dda27 100755
--- a/src/backend/meet/settings.py
+++ b/src/backend/meet/settings.py
@@ -292,6 +292,9 @@ class Base(Configuration):
),
},
}
+ MONITORED_THROTTLE_FAILURE_CALLBACK = (
+ "core.api.throttling.sentry_monitoring_throttle_failure"
+ )
SPECTACULAR_SETTINGS = {
"TITLE": "Meet API",