Repository navigation
Conversation
Replace the per-message errors_replacer.process_message log with one snuba.delete.<state> event per stage, so a delete can be followed per project in Sentry Logs. Only end_delete_groups on the errors path and EAP deletes are logged. Events: received, then a written, failed and skipped event for each of the redis, errors and eap stages (eap uses eap_deleted). Events carry target, project_id, organization_id, group_ids_count, the first 10 group_ids, transaction_id, and reason and error where they apply. Failed events are sent at error level. Replacement insert executors now return the written row count and whether the backup executor ran, for errors_written. Refs EAP-964
On multi-node clusters the replacer uses the sharded executor, so the patched QueryNodeExecutor never ran and the test did not raise. Refs EAP-964
Send each event with one sentry_sdk.logger call where the state happens, using only values already in scope. Remove the delete_log helper module, the insert executor changes, the extra skip and produce-failure events, and the per-event tests. Keep one test for the received event. Refs EAP-964
Log directly inside the type checks instead of building a conditional delete_attrs dict first. Remove the last delete log test. Refs EAP-964
Add the delete_sentry_logs_enabled sentry-option (default false). A before_send_log in setup_sentry drops snuba.delete.* logs unless it is on, so they can be turned on per region without a deploy. Refs EAP-964
_execute_single_delete swallows non-retryable ClickHouse errors, so eap_deleted fired after eap_failed. It now returns False when it swallows an error, and eap_deleted is sent only if every table's delete succeeded. Refs EAP-964
Leave ErrorsReplacer.pre_replacement as on master. flush_batch sends the redis and errors delete logs through one small _log_delete function, based on what pre_replacement returned or raised. Refs EAP-964
After each table's delete, send eap_deleted or eap_failed with storage, table, organization_ids and project_ids. A swallowed error and a raised one both count as failed. Logs now cover every lw_deletions storage. Refs EAP-964
Put strategy.py back to master and only add the log calls: eap_deleted after a delete query succeeds, eap_failed in the existing except, with storage, table and partition_week. Refs EAP-964
Put the replacer, errors replacer and delete endpoint back to master and add only log calls in existing branches. Drop the events that needed new try/except blocks (redis_failed, errors_failed, and eap_failed on the delete endpoint). Events sent from shared replacer branches carry message_type. Refs EAP-964
Add redis_failed and the redis store name; errors_written and errors_failed per ClickHouse connection with host and written_rows; RPC eap_failed and eap_queued; org and project ids on the consumer's per-table events; eap_skipped for already-deleted partitions; eap_delayed when the consumer applies backpressure. Refs EAP-964
…cer-sentry-logs-3fa66e # Conflicts: # snuba/lw_deletions/off_peak.py
Write the attributes straight into the errors_failed and errors_written log calls instead of a shared attributes variable.
Drop the errors_skipped event and write the redis_skipped attributes inline.
Build the eap log attributes from conditions where they are logged, so FormatQuery no longer keeps them in an instance variable.
dezzeddi
marked this pull request as ready for review
November 23, 2026 19:09
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b6b2140. Configure here.
Move eap_queued into produce_delete_query's try block and send eap_failed when the produce raises, so a dropped produce isn't logged as queued.
Merges, unmerges, tombstones and other errors replacements no longer send snuba.delete.* logs.
This branch has not been deployed
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.

Snuba now sends a
snuba.delete.<state>Sentry Log at each stage of an issue delete.received, then*_written/*_failedforredisanderrors,redis_skipped, andeap_deleted/eap_failed/eap_skippedfor EAP.end_delete_groupsreplacements.enable_logsis on, but stdlib logging isn't forwarded, so only these events reach Sentry Logs.Refs EAP-964