-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
feat(occurrences on eap): Implement EAP read for trace-connected issues in related issues calculation #105459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(occurrences on eap): Implement EAP read for trace-connected issues in related issues calculation #105459
Conversation
…ues endpoint) from EAP
| result = Occurrences.run_table_query( | ||
| params=snuba_params, | ||
| query_string=f"trace:{trace_id}", | ||
| selected_columns=["group_id", "count()"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have a count() here in order to get distinct group IDs back
…p-for-related-issues
thetruecpaul
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some nits/ Qs
| gid = int(group_id) | ||
| if gid != exclude_group_id: | ||
| group_ids.add(gid) | ||
| return list(group_ids) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any expectation of ordering from this endpoint?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe so, since the Snuba implementation also relies on a set. But this does raise a good point in that our Snuba/EAP result comparisons will potentially mismatch even when the group ID sets are the same, since we're comparing the lists instead of the sets. Going to refactor these functions to return the set values so we can check_and_choose on those instead, and then the endpoint can convert to list before returning.
| except Exception: | ||
| logger.exception( | ||
| "Fetching trace connected issues from EAP failed", | ||
| extra={ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you log the actual exception message as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe logger.exception automatically captures the exception value when used in an except block
| projects=projects, | ||
| exclude_group_id=group.id, | ||
| ) | ||
| issues = EAPOccurrencesComparator.check_and_choose( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Is there a way to do a reasonable-comparison here? (EAP subset of Snuba?)
- Can you add is-null-result here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, good idea. I'll refactor to do the exact match comparison using the set versions, and then also add a reasonable match comparator checking if the EAP version is a subset of the Snuba version. And sure, I'll add the is_experimental_data_a_null_result param for when the EAP result is empty.
| @@ -0,0 +1,155 @@ | |||
| from unittest import mock | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: I see you've added empty file tests/sentry/issues/related/__init__.py. Is this intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I believe necessary for the directory to be picked up as a py module
The
RelatedIssuesEndpointhas logic which can retrieve issues associated with the same trace as the one included in the request. This PR adds logic which uses anEndpointTraceItemTableRPC query to retrieve trace-connected issues.Tested locally to ensure that the reads are succeeding and the results are matching that of the legacy Snuba read path: