Repository navigation
Don't let Sentry import the integrations' libraries in the HTTP service - #7585
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
By default,
sentry_sdk.initenables the integration of each supported library it can import, which imports that library. The HTTP service image includes all of bugbug's dependencies, so each process imported langchain, langgraph, openai, anthropic, google-genai, huggingface_hub… even though the service uses none of them. With Sentry enabled, importing the web app took ~344 MB instead of ~96 MB.The integrations are now only Sentry's defaults (logging, excepthook, threading…) and the explicit ones (Flask for the web, RQ for the workers), plus Redis for its breadcrumbs. I checked with a local Sentry sink that warnings and unhandled request exceptions are still reported, with request data, release and breadcrumbs.
Fixes #7588