Repository navigation
chore: logging to figure out why tasks not getting created properly - #106448
Conversation
There was a problem hiding this comment.
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 options.get("seer.explorer_index.killswitch.enable"): | ||
| logger.info("seer.explorer_index.killswitch.enable flag enabled, skipping") | ||
| return |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
this is just running on s4s right now
…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.
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.