Skip to content

ref(seer): Refactor explorer service map query and instrumentation#109322

Merged
shruthilayaj merged 3 commits intomasterfrom
feat/explorer-service-map-improvements
Feb 25, 2026
Merged

ref(seer): Refactor explorer service map query and instrumentation#109322
shruthilayaj merged 3 commits intomasterfrom
feat/explorer-service-map-improvements

Conversation

@shruthilayaj
Copy link
Member

Refactors the service map dependency extraction in the Explorer Seer pipeline across three areas.

Query simplification: Removes pagination loops from the broad and fallback scans. Each is now a single query capped at min(_SNUBA_MAX_ROWS, max_segments). _SNUBA_MAX_ROWS is bumped from 100 to 10000, which makes the single-query approach viable for realistic org sizes without needing multiple round trips.

Parent resolution batching: The parent span resolution step retains batching but at a fixed 1000 spans per batch (previously used _SNUBA_MAX_ROWS = 100). This bounds query string size — at 10k parent spans that would have been a ~250 KB OR clause in a single request.

Edges in Seer payload: _send_to_seer now sends edges alongside nodes so the downstream service has the full graph structure rather than just the derived node metadata.

Span instrumentation: Added sentry_sdk spans around each query phase with relevant data attached:

  • explorer.service_map.broad_scan: limit, rows_returned, covered_projects
  • explorer.service_map.fallback_scan: uncovered_projects, limit, rows_returned (only created when there are actually uncovered projects)
  • explorer.service_map.resolve_parents: unique_parent_spans, batch_count, edges_found

Remove pagination loops from the broad and fallback scans in favour of
single queries capped at min(_SNUBA_MAX_ROWS, max_segments). Bump
_SNUBA_MAX_ROWS from 100 to 10000 so a single query covers realistic
org sizes. Restore batching in the parent-resolution step at a fixed
1000 spans per batch to keep query strings within reasonable size limits.

Send edges alongside nodes in the Seer payload so the downstream service
has the full graph structure.

Add sentry_sdk span instrumentation around each query phase
(broad_scan, fallback_scan, resolve_parents) with per-span data for
limit, rows_returned, covered_projects, unique_parent_spans, batch_count,
and edges_found.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Feb 25, 2026
Renames the module and test file and updates all import paths and mock
patch strings. Celery task broker names (name= in @instrumented_task)
are intentionally unchanged to preserve backward compatibility with
already-queued tasks.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
@shruthilayaj shruthilayaj marked this pull request as ready for review February 25, 2026 17:41
@shruthilayaj shruthilayaj requested a review from a team as a code owner February 25, 2026 17:41
@shruthilayaj shruthilayaj merged commit 55bb1d9 into master Feb 25, 2026
100 of 101 checks passed
@shruthilayaj shruthilayaj deleted the feat/explorer-service-map-improvements branch February 25, 2026 18:24
@github-actions github-actions bot locked and limited conversation to collaborators Mar 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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