Skip to content

Conversation

@BYK
Copy link
Member

@BYK BYK commented Nov 27, 2025

Align the Spotlight implementation with the official spec at
https://develop.sentry.dev/sdk/expected-features/spotlight/

Changes:

  1. Fix precedence rules:

    • When spotlight=True and SENTRY_SPOTLIGHT env var is a URL, use the
      env var URL (per spec requirement)
    • Log warning when config URL overrides env var URL
    • Log warning when spotlight=False explicitly disables despite env
      var being set
  2. Route all envelopes to Spotlight:

    • Sessions, logs, and metrics now also get sent to Spotlight via the
      _capture_envelope callback
    • Move Spotlight initialization before batchers are created
  3. Add exponential backoff retry logic:

    • SpotlightClient now implements proper exponential backoff when the
      Spotlight server is unreachable
    • Skips sending during backoff period to avoid blocking
    • Logs errors only once per backoff cycle
  4. Update tests:

    • Fix test expectation for spotlight=True + env URL case
    • Add tests for warning scenarios
    • Add test for session envelope routing to Spotlight

Align the Spotlight implementation with the official spec at
https://develop.sentry.dev/sdk/expected-features/spotlight/

Changes:

1. Fix precedence rules:
   - When spotlight=True and SENTRY_SPOTLIGHT env var is a URL, use the
     env var URL (per spec requirement)
   - Log warning when config URL overrides env var URL
   - Log warning when spotlight=False explicitly disables despite env
     var being set

2. Route all envelopes to Spotlight:
   - Sessions, logs, and metrics now also get sent to Spotlight via the
     _capture_envelope callback
   - Move Spotlight initialization before batchers are created

3. Add exponential backoff retry logic:
   - SpotlightClient now implements proper exponential backoff when the
     Spotlight server is unreachable
   - Skips sending during backoff period to avoid blocking
   - Logs errors only once per backoff cycle

4. Update tests:
   - Fix test expectation for spotlight=True + env URL case
   - Add tests for warning scenarios
   - Add test for session envelope routing to Spotlight
@BYK BYK marked this pull request as ready for review November 27, 2025 23:23
@BYK BYK requested a review from a team as a code owner November 27, 2025 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants