Skip to content

fix(cli): stop Sentry from recording frame local variables - #1579

Merged
wcchang1115 merged 1 commit into
mainfrom
feature/drc-4940-recce-server-memory-grows-from-1-gb-to-5-7-gb-when-a-run
Oct 21, 2026
Merged

wcchang1115 merged 1 commit into
mainfrom
feature/drc-4940-recce-server-memory-grows-from-1-gb-to-5-7-gb-when-a-run

Conversation

@wcchang1115

@wcchang1115 wcchang1115 commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

PR checklist

  • Ensure you have added or ran the appropriate tests for your PR.
  • DCO signed

What type of PR is this?

fix

What this PR does / why we need it:

When a run fails, recce/apis/run_func.py sends the exception to Sentry. By default, Sentry records the local variables of each frame in the traceback and calls repr() on them. These locals can include a DbtAdapter. It is a dataclass, so its repr() includes the full manifest and base_manifest. On a large dbt project, one Sentry event can reach several GB, and the server keeps that memory until the upload ends.

This PR passes include_local_variables=False to sentry_sdk.init.

Which issue(s) this PR fixes:

Special notes for your reviewer:

Sentry events no longer carry frame local variables for any error, not only for failed runs.

Does this PR introduce a user-facing change?:

🤖 Generated with Claude Code

When a run fails, Sentry records the local variables of each frame,
and these include the full dbt manifests. On a large project, one event
can reach several GB and keep server memory high for minutes. Turn off
include_local_variables, so Sentry events no longer carry frame locals.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Wei-Chun, Chang <wcchang@infuseai.io>
@wcchang1115
wcchang1115 marked this pull request as ready for review October 21, 2026 08:58

@kentwelcome kentwelcome left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wcchang1115
wcchang1115 merged commit a7eddeb into main Oct 21, 2026
22 checks passed
@wcchang1115
wcchang1115 deleted the feature/drc-4940-recce-server-memory-grows-from-1-gb-to-5-7-gb-when-a-run branch October 21, 2026 08:59
@codecov

codecov Bot commented Oct 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
recce/event/__init__.py 85.71% <ø> (ø)
tests/event/test_sentry_env.py 100.00% <100.00%> (ø)

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants