Skip to content

ref(seer): add viewer_context_scope to ingest and explorer_index paths - #121467

Merged
sehr-m merged 1 commit into
masterfrom
sehr/viewer-context-entrypoints
Aug 7, 2026
Merged

ref(seer): add viewer_context_scope to ingest and explorer_index paths#121467
sehr-m merged 1 commit into
masterfrom
sehr/viewer-context-entrypoints

Conversation

@sehr-m

@sehr-m sehr-m commented Aug 6, 2026

Copy link
Copy Markdown
Member

Summary

  • Set viewer_context_scope in _do_save_event (store.py) after project is resolved, wrapping EventManager.save() and downstream processing. Covers all Seer calls in the ingest pipeline (grouping similarity, training, severity scoring).
  • Set viewer_context_scope in run_explorer_index_for_projects (explorer_index.py) for single-org batches around the make_agent_index_request call.
  • These two paths account for 100% of seer.viewer_context_not_set warnings observed in production after deploying the instrumentation in ref(seer): instrument _resolve_viewer_context for SeerViewerContext retirement #121270.

Part of AIML-3206 (SeerViewerContext retirement Step 2).

Test plan

  • New e2e tests verify get_viewer_context() returns correct org_id, project_id, and actor_type inside EventManager.save() and make_agent_index_request
  • All existing tests pass (38 total across store.py and explorer_index.py)
  • After deploy: seer.viewer_context_not_set warnings in GCP logs (sentry-s4s2) should drop to zero

Set ViewerContext at the entrypoint for the two code paths that were
firing `seer.viewer_context_not_set` warnings in production:

- `_do_save_event` in store.py: wrap EventManager.save() with
  viewer_context_scope after project is resolved. Covers all Seer calls
  in the ingest pipeline (grouping similarity, training, severity).
- `run_explorer_index_for_projects` in explorer_index.py: wrap the
  make_agent_index_request call for single-org batches.

Part of AIML-3206 (SeerViewerContext retirement Step 2).
@linear-code

linear-code Bot commented Aug 6, 2026

Copy link
Copy Markdown

AIML-3206

@sehr-m
sehr-m marked this pull request as ready for review August 6, 2026 17:50
@sehr-m
sehr-m requested review from a team as code owners August 6, 2026 17:50
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Aug 6, 2026
@sehr-m
sehr-m merged commit 5e1fcc7 into master Aug 7, 2026
66 checks passed
@sehr-m
sehr-m deleted the sehr/viewer-context-entrypoints branch August 7, 2026 00:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants