From ebfd4efd8fd57f433c2542d78a270e59bd8d0017 Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Thu, 19 Nov 2026 14:03:32 +0100 Subject: [PATCH] Don't let Sentry import the integrations' libraries in the HTTP service By default, Sentry enables the integration of each supported library it can import, importing it. The HTTP service's image includes all of bugbug's dependencies, so each process imported langchain, langgraph, openai, anthropic, google-genai, huggingface_hub..., which it doesn't use: with Sentry enabled, importing the web app took ~344 MB instead of ~96 MB. The integrations are now only the default ones (logging, excepthook, threading, ...) and the explicit ones (Flask for the web processes, RQ for the workers), plus Redis, whose breadcrumbs are useful. --- http_service/bugbug_http/sentry.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/http_service/bugbug_http/sentry.py b/http_service/bugbug_http/sentry.py index de0ee372b64..c16e8ccb035 100644 --- a/http_service/bugbug_http/sentry.py +++ b/http_service/bugbug_http/sentry.py @@ -8,6 +8,7 @@ import sentry_sdk from sentry_sdk.integrations.logging import LoggingIntegration +from sentry_sdk.integrations.redis import RedisIntegration from bugbug import get_bugbug_version @@ -23,6 +24,10 @@ def setup_sentry(dsn, integrations=None): ) sentry_sdk.init( dsn=dsn, - integrations=[logging_integration] + integrations, + integrations=[logging_integration, RedisIntegration()] + integrations, + # Sentry would otherwise enable the integrations of all the supported libraries installed, + # importing them: the AI ones (langchain, openai, anthropic...) the service doesn't use add + # ~250 MB to each process. + auto_enabling_integrations=False, release=get_bugbug_version(), )