Repository navigation
feat(issues): Add related issues endpoint with similar stack traces - #130867
Conversation
Add GET /organizations/{org}/issues/{issue_id}/related/, a typed private endpoint that
returns other issues related to an issue, each with the reasons it's related. It's meant for
agents triaging an issue: before resolving or ignoring it, check whether it duplicates another.
This first version has one type, similar_stacktrace: issues whose stack traces Seer finds
similar to the issue's latest event. meta.types says whether each requested type ran, doesn't
apply to the issue, or failed, so an empty result can be told apart from a Seer outage. The
endpoint returns 503 only when every requested type failed.
The Seer request is built by helpers that the Similar Issues tab's endpoint now shares, with
no change to that endpoint's responses.
| return Response([]) | ||
|
|
||
| model_version = get_grouping_model_version(group.project) | ||
| stacktrace_string = get_seer_stacktrace(latest_event, model_version) |
There was a problem hiding this comment.
most of these changes are extracting out shared logic to src/sentry/issues/related/similar_stacktrace.py
| from sentry.models.group import Group | ||
|
|
||
|
|
||
| def combine( |
There was a problem hiding this comment.
This func isn't doing much here but the idea is as we add new RelationTypes (e.g stacktrace, same trace, similar title etc.) we want to dedupe if there's the same issue turning up in each relation.
Seer only indexes error issues, so a metric or performance issue has nothing to compare against. Report similar_stacktrace as not_applicable for them before any other check, the same rule the UI uses to decide where to show similar issues. Before, a non-error issue whose event had frames would have been sent to Seer.
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.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit dd94f9d. Configure here.

Adds
GET /api/0/organizations/{org}/issues/{issue_id}/related/, that given an issue returns related information (such as other issues in this PR to them). Next PRs add other relation types to the endpoint.The first relation (type) is
similar_stacktrace- i.e seer-embeddings that returns X (default 10) issues that from embeddings are similar based off stacktrace.{ "data": [ { "issue": {"id": "...", "shortId": "...", "...": "..."}, "relations": [{"type": "similar_stacktrace", "score": 0.97}] } ], "meta": { "types": [ {"type": "similar_stacktrace", "status": "ok", "eventId": "60fc17404bf4445c81675be939ef74d6"} ] } }datacontains a list of serialized issues and each contain a list ofrelationsthat say which relationtype that issue fell under. For this one it'd be similar_stacktrace, future ones could berelated_title,contributingetc.meta.typesgives each relationtype's status (ok,not_applicable, orunavailable), so an empty result can be told apart from a failure. For example,not_applicablewould be for metric issues w/similar_stacktracesince we can't have embeddings on metric issues. The endpoint returns 503 only when every requested relation is unavailable.