Skip to content

feat(issues): Add same trace issues to the related issues endpoint - #130992

Merged
Christinarlong merged 1 commit into
masterfrom
unified-similarity-api-same-trace
Nov 13, 2026
Merged

Christinarlong merged 1 commit into
masterfrom
unified-similarity-api-same-trace

Conversation

@Christinarlong

@Christinarlong Christinarlong commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Adds another relation type, same_trace, to GET /api/0/organizations/{org}/issues/{issue_id}/related/. It returns issues, in any project the caller can read, with errors in the same trace as the issue's latest event.

It reuses trace_connected_issues(), the same lookup behind the trace section of the Similar Issues tab. When both types find the same issue, it becomes one entry, and issues w/ more relations

Response example

{
  "data": [
    {
      "issue": {"id": "...", "shortId": "...", "...": "..."},
      "relations": [{"type": "similar_stacktrace", "score": 0.97}, {"type": "same_trace"}]
    }
  ],
  "meta": {
    "types": [
      {"type": "similar_stacktrace", "status": "ok", "eventId": "60fc17404bf4445c81675be939ef74d6"},
      {"type": "same_trace", "status": "ok", "eventId": "60fc17404bf4445c81675be939ef74d6", "traceId": "a7d67cf796774551a95be6543cacd459"}
    ]
  }
}

same_trace is not_applicable when the issue has no events. It's unavailable when the trace query fails, and the endpoint still returns 200 as long as another requested type answered.

The related issues endpoint gains a same_trace type: issues, in any project the caller can read, with errors in the same trace as the issue's latest event. It reuses trace_connected_issues(), which backs the trace section of the Similar Issues tab, and returns the most recently seen first.

When several types find the same issue, it becomes one entry with a relation for each, and issues matched by more types come first.
@Christinarlong Christinarlong self-assigned this Nov 12, 2026
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Nov 12, 2026
@Christinarlong
Christinarlong marked this pull request as ready for review November 12, 2026 21:32
@Christinarlong
Christinarlong requested review from a team as code owners November 12, 2026 21:32
@Christinarlong
Christinarlong merged commit e07bed8 into master Nov 13, 2026
84 checks passed
@Christinarlong
Christinarlong deleted the unified-similarity-api-same-trace branch November 13, 2026 02:12
Christinarlong added a commit that referenced this pull request Nov 13, 2026
…131008)

- Adds a third relation type, `contributing`, to the `GroupRelated`
endpoint.
- For a metric issue whose detector counts errors or releases, it
returns the issues that match the detector's query during the open
period, from most events to least.

- This query btw is the same as the `Contributing Issues` section within
Metric Issues, but agents have no way to reach that today. The search
covers the metric issue's latest open period, starting one detector
interval and a minute before it so we can capture the 'triggering'
parts.

Response example for a metric issue:
```json
{
  "data": [
    {
      "issue": {"id": "...", "shortId": "...", "...": "..."},
      "relations": [{"type": "contributing"}]
    }
  ],
  "meta": {
    "types": [
      {"type": "similar_stacktrace", "status": "not_applicable", "detail": "Only error issues have similar stack traces."},
      {"type": "same_trace", "status": "ok", "eventId": "60fc17404bf4445c81675be939ef74d6", "traceId": "a7d67cf796774551a95be6543cacd459"},
      {"type": "contributing", "status": "ok", "eventId": "60fc17404bf4445c81675be939ef74d6", "start": "2026-11-12T21:43:00+00:00"}
    ]
  }
}
```

`contributing` is `not_applicable` for issues that aren't metric issues,
for detectors on other datasets (spans, logs, transactions), and for
detector queries issue search can't run, such as ones with AND or OR.
It's `unavailable` when the search fails.

Stacked on #130992.
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