Skip to content

Show N+1 issues in the issue list, sparklines and histogram - #46

Merged
bashgeek merged 3 commits into
mainfrom
fix/n1-issues-in-list
Nov 2, 2026
Merged

bashgeek merged 3 commits into
mainfrom
fix/n1-issues-in-list

Conversation

@bashgeek

@bashgeek bashgeek commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Summary

N+1 issues record their occurrences in perf_events, but the time-windowed issue queries, sparklines and issue histogram only read events. As a result, open N+1 issues were missing from the issue list, its count and the export when a time range was applied. Their sparklines and detail charts also showed all zeros.

These queries now read both tables. The fixes use existing perf_events rows, so no migration is needed and older N+1 issues get their history back as far as retention has kept those rows.

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Docs / config only

Changes

  • windowIssueCTE now includes perf_events occurrences for non-error issues, so N+1 issues appear in the windowed list, count and export. It applies the same time, project and environment filters to them.
  • User-filtered views still leave out performance issues, because a transaction names no user.
  • GetIssueSparklines counts occurrences from both events and perf_events.
  • GetIssueHistogram counts occurrences from both tables, so the issue detail chart is no longer empty for N+1 issues.
  • IssueListView.vue no longer hides the sparkline on n1_query rows.
  • Added an opt-in query plan test, TestWindowPerformanceIssuesPlan, which checks that the windowed perf_events lookup uses perf_events_issue rather than a sequential scan. It only runs when TINDRA_PERF_ROWS is set to at least 10000.

Review note: GetIssueHistogram has no time limit, so it reads every retained perf_events row for the issue, as it already does with events for error issues. It only runs when an issue's detail page is opened and uses perf_events_issue, but an N+1 issue with millions of occurrences would load its chart more slowly. This hasn't been measured at scale.

Test plan

  • Added storage tests for N+1 issues covering window bounds, the All range, environment, project, kind, status and user filters, plus sparkline and histogram counts.
  • The new sparkline and histogram tests failed before their fixes with all-zero results and pass now.
  • Added a frontend test that n1_query rows render a sparkline.
  • go test -race ./... and golangci-lint pass on the full change.
  • Frontend tests, the type check and oxlint passed before the histogram commit, and weren't re-run after it because that commit is Go only.
  • Not yet checked in a browser or against production data.

Checklist

  • Tests added or updated
  • No new dependencies introduced (or justified in the PR description)
  • I assign copyright in this contribution to Blendbyte GmbH, as required by the
    Contributor License Agreement

The issue list, its count and the export only matched issues with rows in
events. N+1 detection records occurrences in perf_events, so these issues
were missing from the list at every range and status, while the dashboard
briefing and its open count read the issues table and showed them.

Count perf_events as occurrences too. The lookup starts from performance
issues to use perf_events_issue, since nothing else reaches that table by
time. A user lens leaves them out because a transaction names no user.
GetIssueSparklines only read events, so N+1 issues always drew a flat line
on the dashboard. Count perf_events as well, and stop hiding the sparkline
on N+1 rows in the issue list now that it has data.
- Union events and perf_events in GetIssueHistogram so performance issues such as N+1 queries show their occurrences
- Add test covering the histogram for a performance issue
@codecov

codecov Bot commented Nov 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@bashgeek
bashgeek merged commit 6460d4a into main Nov 2, 2026
8 checks passed
@bashgeek
bashgeek deleted the fix/n1-issues-in-list branch November 2, 2026 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant