feat(occurrences on eap): Implement EAP query for eventstore get_events#112423
Open
feat(occurrences on eap): Implement EAP query for eventstore get_events#112423
get_events#112423Conversation
…hed_events`) to query EAP
shashjar
commented
Apr 7, 2026
| stripped = col.lstrip("-") | ||
| prefix = "-" if col.startswith("-") else "" | ||
| # EAP uses "id" as the public alias for event_id | ||
| eap_name = "id" if stripped == "event_id" else stripped |
Member
Author
There was a problem hiding this comment.
Special case needed here
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: EAP double-read skipped on nodestore optimization path
- Added EAP double-read comparison logic to the nodestore optimization path so validation now runs consistently for all callsites regardless of which query path is taken.
Or push these changes by commenting:
@cursor push 4db9973e34
Preview (4db9973e34)
diff --git a/src/sentry/services/eventstore/snuba/backend.py b/src/sentry/services/eventstore/snuba/backend.py
--- a/src/sentry/services/eventstore/snuba/backend.py
+++ b/src/sentry/services/eventstore/snuba/backend.py
@@ -352,6 +352,58 @@
for event in events:
node_data = nodestore_dict[(event.event_id, event.project_id)]
event.data.bind_data(node_data)
+
+ callsite = "eventstore.backend.get_events"
+ if (
+ eap_conditions is not None
+ and tenant_ids
+ and "organization_id" in tenant_ids
+ and EAPOccurrencesComparator.should_check_experiment(callsite)
+ ):
+ occurrence_category = (
+ OccurrenceCategory.ISSUE_PLATFORM
+ if dataset == Dataset.IssuePlatform
+ else OccurrenceCategory.ERROR
+ )
+ eap_results = self._get_events_eap(
+ eap_conditions=eap_conditions,
+ project_ids=filter.project_ids or [],
+ organization_id=tenant_ids["organization_id"],
+ occurrence_category=occurrence_category,
+ orderby=orderby,
+ limit=limit,
+ offset=offset,
+ referrer=referrer,
+ start=filter.start,
+ end=filter.end,
+ group_ids=filter.group_ids,
+ )
+ control_data = {(e.event_id, e.group_id) for e in events}
+ experimental_data = (
+ {(row["id"], row["group_id"]) for row in eap_results}
+ if eap_results is not None
+ else set()
+ )
+ EAPOccurrencesComparator.check_and_choose(
+ control_data=control_data,
+ experimental_data=experimental_data,
+ callsite=callsite,
+ is_experimental_data_a_null_result=eap_results is None,
+ reasonable_match_comparator=lambda ctl, exp: exp.issubset(ctl),
+ debug_context={
+ "project_ids": list(filter.project_ids)
+ if filter.project_ids
+ else [],
+ "group_ids": list(filter.group_ids) if filter.group_ids else [],
+ "dataset": dataset.value,
+ "limit": limit,
+ "offset": offset,
+ "referrer": referrer,
+ "control_count": len(events),
+ "experimental_count": len(experimental_data),
+ },
+ )
+
return events
return []This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2c5b26e. Configure here.
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.


Implements an EAP query (double read) for the eventstore's
__get_eventsfunction (used by bothget_events&get_unfetched_events) insrc/sentry/services/eventstore/snuba/backend.py.Rather than write logic to convert an
eventstore.Filtervalue to the equivalent format needed for an EAP query, I'm adding logic here to createeap_conditionsat the individual callsites.