Skip to content

Tighten Sentry init (traces_sample_rate, profiling) #200

Description

@YaronZaki
  • Difficulty: good-first-issue · Effort: XS · Impact: observability cost

  • Problem Statement
    quantara/web_app/api/main.py calls:

    sentry_sdk.init(
        dsn=os.getenv("SENTRY_DSN"),
        traces_sample_rate=1.0,
        _experiments={"continuous_profiling_auto_start": True},
    )

    Two problems: 100% sampling is a temporary expedient that's disastrous
    once traffic climbs. _experiments is an unstable surface; Sentry has
    no compatibility guarantee on those keys.

  • Why It Matters
    At 50k req/day, a 100% sample rate sends 50k spans/hour into Sentry, a
    monthly bill north of five figures within weeks of go-live.

  • Expected Outcome
    Configurable samples from env (SENTRY_TRACES_SAMPLE_RATE default 0.1,
    SENTRY_PROFILES_SAMPLE_RATE default 0.1); _experiments removed.

  • Acceptance Criteria

    • Process startup logs the active sample rate.
    • _experiments removed from init call.
    • docs/environment_variables.md updated with both new env vars.
    • Trace volume test (synthetic burst of 100 req in 1 min) confirms ratio <0.1 in Sentry.
  • Implementation Notes

    sentry_sdk.init(
        dsn=os.getenv("SENTRY_DSN"),
        traces_sample_rate=float(os.getenv("SENTRY_TRACES_SAMPLE_RATE", "0.1")),
        profiles_sample_rate=float(os.getenv("SENTRY_PROFILES_SAMPLE_RATE", "0.1")),
    )
  • Files / Modules Affected

    • quantara/web_app/api/main.py
    • quantara/web_app/config_validator.py
    • docs/environment_variables.md
  • Dependencies: standalone.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26infraImported from PRODUCTION_ISSUES.mdpriority/P1Imported from PRODUCTION_ISSUES.mdsecurity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions