Skip to content

feat(occurrences on eap): Implement double reads from EAP for monitors associated groups#108008

Merged
shashjar merged 8 commits intomasterfrom
implement-eap-occurrence-double-reads-monitors-fetch-associated-groups
Mar 2, 2026
Merged

feat(occurrences on eap): Implement double reads from EAP for monitors associated groups#108008
shashjar merged 8 commits intomasterfrom
implement-eap-occurrence-double-reads-monitors-fetch-associated-groups

Conversation

@shashjar
Copy link
Member

Implements double reads of occurrences from EAP for fetch_associated_groups in src/sentry/monitors/utils.py.

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Feb 11, 2026
@shashjar shashjar requested review from a team and thetruecpaul February 12, 2026 18:44
@shashjar shashjar marked this pull request as ready for review February 12, 2026 18:45
@shashjar shashjar requested a review from a team as a code owner February 12, 2026 18:45
trace_ids: list[str], organization_id: int, project_id: int, start: datetime, end: datetime
) -> dict[str, list[dict[str, int | str]]]:
"""
Returns serializer appropriate group_ids corresponding with check-in trace ids.
Copy link
Member

Choose a reason for hiding this comment

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

Nit: What does serializer appropriate mean here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Just that there's some formatting of the data on top that the serializer (caller for this function) expects. Will update this comment to clarify

assert result == {}


class FetchAssociatedGroupsDoubleReadTest(TestCase):
Copy link
Member

Choose a reason for hiding this comment

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

Same mocking question here - How do we know any of this works if it's all mocked?

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, these tests are really just for the sentry side of things (structuring the eap query + testing that the double reads with snuba execute as expected), not meant to be e2e tests against an actual eap backend.

agreed we should have those tho, it's on my todo list to get occurrences supported in SnubaTestCase

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated the tests, e2e now

return dict(group_id_data)


def _fetch_associated_groups_eap(
Copy link
Member Author

@shashjar shashjar Feb 25, 2026

Choose a reason for hiding this comment

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

Note: this query is doing essentially the same thing as what's implemented in src/sentry/issues/related/trace_connected.py (get groups associated with some trace IDs). As a potential follow-up item: implement a higher-level query in src/sentry/search/eap/occurrences/common_queries.py that both src/sentry/issues/related/trace_connected.py & src/sentry/monitors/utils.py (and src/sentry/api/endpoints/organization_events_trace.py and likely other callsites) can rely on.

Self-note: look for any other possible abstractions as well, as we continue migrating more read paths.

@shashjar shashjar merged commit 71d427b into master Mar 2, 2026
56 of 57 checks passed
@shashjar shashjar deleted the implement-eap-occurrence-double-reads-monitors-fetch-associated-groups branch March 2, 2026 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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