Skip to content

chore: logging to figure out why tasks not getting created properly - #106448

Merged
shruthilayaj merged 2 commits into
masterfrom
shruthi/chore/debug-explorer-indexer-job
Jan 16, 2026
Merged

shruthilayaj merged 2 commits into
masterfrom
shruthi/chore/debug-explorer-indexer-job

Conversation

@shruthilayaj

Copy link
Copy Markdown
Member

The periodic schedule_explorer_index task should be kicking off
subsequent run_explorer_index_for_projects tasks,
but I don't see them getting created. Adding some logs
to debug what's happening.

@shruthilayaj
shruthilayaj requested a review from a team January 16, 2026 16:54
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jan 16, 2026
@shruthilayaj shruthilayaj changed the title chore: logging to figure out why job not getting scheduled chore: logging to figure out why tasks not getting created properly Jan 16, 2026
@shruthilayaj
shruthilayaj enabled auto-merge (squash) January 16, 2026 16:55

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Comment thread src/sentry/tasks/seer_explorer_index.py Resolved
@shruthilayaj
shruthilayaj disabled auto-merge January 16, 2026 16:57
Comment on lines 47 to 49
if options.get("seer.explorer_index.killswitch.enable"):
logger.info("seer.explorer_index.killswitch.enable flag enabled, skipping")
return

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The killswitch check is inside the project iteration loop, causing the generator to terminate prematurely if the switch is enabled, leading to partial processing of projects.
Severity: HIGH

Suggested Fix

Move the killswitch check to before the for loop in get_seer_explorer_enabled_projects. This ensures that the task is either fully executed for all projects or not at all, providing all-or-nothing behavior consistent with the purpose of a killswitch.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: src/sentry/tasks/seer_explorer_index.py#L47-L49

Potential issue: In the `get_seer_explorer_enabled_projects` generator, the killswitch
option `seer.explorer_index.killswitch.enable` is checked inside the `for` loop that
iterates over all projects. If this option is enabled mid-execution, the `return`
statement at line 49 will terminate the entire generator prematurely. This results in an
incomplete and non-deterministic set of projects being processed, as only the projects
yielded before the killswitch was checked will be passed on. The log message 'skipping'
is also misleading, as it implies a single project is skipped, not that the entire task
is terminated.

Did we get this right? 👍 / 👎 to inform future reviews.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

if has_feature:
yield project.id, project.organization_id
else:
logger.info("organizations:seer-explorer-index flag not enabled, skipping")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excessive logging for every non-feature-flagged project

Medium Severity

The new else branch logs "organizations:seer-explorer-index flag not enabled, skipping" for every active project that lacks the feature flag. Since the function iterates over ALL active projects via RangeQuerySetWrapper, this could emit hundreds of thousands or millions of log entries if most projects don't have the feature enabled. This log spam would degrade performance and make the debugging logs counterproductively noisy. The message would be more useful as a single summary count after the loop completes.

Fix in Cursor Fix in Web

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is just running on s4s right now

@shruthilayaj
shruthilayaj merged commit a06fc64 into master Jan 16, 2026
65 checks passed
@shruthilayaj
shruthilayaj deleted the shruthi/chore/debug-explorer-indexer-job branch January 16, 2026 17:20
BYK pushed a commit that referenced this pull request Jan 19, 2026
…106448)

The periodic schedule_explorer_index task should be kicking off 
subsequent run_explorer_index_for_projects tasks,
but I don't see them getting
[created](https://app.datadoghq.com/s/FH6-Y3/crz-ct3-e23). Adding some
logs
to debug what's happening.
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 1, 2026

This branch was successfully deployed

1 active deployment
Preview — bad5d8e3 Deployed Jan 16, 2026 by vercel[bot]
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