Skip to content

feat(issues): Add related issues endpoint with similar stack traces - #130867

Merged
Christinarlong merged 3 commits into
masterfrom
unified-similarity-api
Nov 12, 2026
Merged

Christinarlong merged 3 commits into
masterfrom
unified-similarity-api

Conversation

@Christinarlong

@Christinarlong Christinarlong commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

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"}
    ]
  }
}

data contains a list of serialized issues and each contain a list of relations that say which relationtype that issue fell under. For this one it'd be similar_stacktrace, future ones could be related_title, contributing etc.

meta.types gives each relationtype's status (ok, not_applicable, or unavailable), so an empty result can be told apart from a failure. For example, not_applicable would be for metric issues w/ similar_stacktrace since we can't have embeddings on metric issues. The endpoint returns 503 only when every requested relation is unavailable.

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.
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 12, 2026
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 12, 2026
return Response([])

model_version = get_grouping_model_version(group.project)
stacktrace_string = get_seer_stacktrace(latest_event, model_version)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.
@Christinarlong
Christinarlong marked this pull request as ready for review November 12, 2026 18:11
@Christinarlong
Christinarlong requested review from a team as code owners November 12, 2026 18:11

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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.

@Christinarlong
Christinarlong merged commit a4d3292 into master Nov 12, 2026
80 checks passed
@Christinarlong
Christinarlong deleted the unified-similarity-api branch November 12, 2026 21:13
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 Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants