chore: filter out GET /metrics logs (#391)

This commit is contained in:
Rajat Ahuja 2026-02-18 11:42:05 -05:00 committed by GitHub
parent e0afc386ce
commit 233df802f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 0 deletions

View File

@ -74,6 +74,15 @@ logger = logging.getLogger(__name__)
logging.getLogger("cashews.backends.redis.client").setLevel(logging.CRITICAL)
class MetricsAccessFilter(logging.Filter):
def filter(self, record: logging.LogRecord) -> bool:
msg = record.getMessage()
return "GET /metrics" not in msg
logging.getLogger("uvicorn.access").addFilter(MetricsAccessFilter())
def before_send(event: "Event", hint: "Hint | None") -> "Event | None":
"""Filter out events raised from known non-actionable exceptions before Sentry sees them."""
if not hint: