ref(seer): add viewer_context_scope to ingest and explorer_index paths - #121467
Merged
Conversation
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).
sehr-m
marked this pull request as ready for review
August 6, 2026 17:50
gricha
approved these changes
Aug 6, 2026
4 tasks
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.
Summary
viewer_context_scopein_do_save_event(store.py) after project is resolved, wrappingEventManager.save()and downstream processing. Covers all Seer calls in the ingest pipeline (grouping similarity, training, severity scoring).viewer_context_scopeinrun_explorer_index_for_projects(explorer_index.py) for single-org batches around themake_agent_index_requestcall.seer.viewer_context_not_setwarnings 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
get_viewer_context()returns correct org_id, project_id, and actor_type insideEventManager.save()andmake_agent_index_requestseer.viewer_context_not_setwarnings in GCP logs (sentry-s4s2) should drop to zero