From 6742f5d19d9a4adb51c450b221bc031ff4ca4e59 Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Mon, 9 Feb 2026 14:58:42 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8(backend)=20monitor=20throttling=20rat?= =?UTF-8?q?e=20failure=20through=20sentry?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use a mixin, introduced by @lunika in the shared backend library to monitor throttling behavior. The mixin tracks when throttling limits are reached, sending errors to Sentry to trigger alerts when configured. This helps detect misconfigurations, fine-tune throttling settings, and identify suspicious operations. This enables safely increasing API throttling limits while ensuring stability, providing confidence that higher limits won’t break the system. --- CHANGELOG.md | 4 ++++ src/backend/core/api/throttling.py | 18 +++++++++++++++--- src/backend/meet/settings.py | 3 +++ 3 files changed, 22 insertions(+), 3 deletions(-) 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",