Skip to content

Add Query Store history drill-down with multi-plan charting#98

Merged
erikdarlingdata merged 1 commit intodevfrom
feature/query-store-history
Mar 17, 2026
Merged

Add Query Store history drill-down with multi-plan charting#98
erikdarlingdata merged 1 commit intodevfrom
feature/query-store-history

Conversation

@erikdarlingdata
Copy link
Owner

@erikdarlingdata erikdarlingdata commented Mar 17, 2026

Summary

  • Right-click "View History" on any Query Store grid row to see time-series performance history
  • ScottPlot.Avalonia chart with one colored line per plan — makes plan regressions immediately visible
  • 13 selectable metrics: Avg/Total CPU, Duration, Reads, Writes, Physical Reads, plus Avg Memory, Avg Rows, Executions
  • SQL aggregates across execution_type (Regular/Aborted/Exception) with weighted averages
  • UTC-aware: filters with GETUTCDATE(), displays local time on chart axis and grid
  • Hover tooltip shows plan name, metric value, and timestamp
  • Adjustable hours-back (1-720) with Refresh button

Test plan

  • Build: 0 errors
  • Right-click → View History opens window with chart and grid
  • Multi-plan queries show separate colored lines
  • Metric selector switches chart data
  • Refresh reloads without stacking legends
  • Rows consolidated per interval (no execution_type split)
  • Hover tooltip shows nearest data point info
  • Times displayed in local time, not UTC

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added "View History" context menu option to the query grid
    • New Query Store History window for viewing performance metrics over time
    • Interactive chart visualization with selectable metrics
    • Detailed history data grid displaying per-plan execution statistics
    • Time range filtering with customizable lookback period
    • Manual refresh capability to update historical data

- Right-click "View History" on any Query Store row opens a history window
- ScottPlot.Avalonia chart shows time-series metrics per plan (separate colored lines)
- 13 selectable metrics: 7 averages + 5 totals + executions
- SQL aggregates across execution_type (Regular/Aborted/Exception) via GROUP BY
- UTC-aware: filters with GETUTCDATE(), displays in local time
- Hover tooltip shows plan, metric value, and timestamp
- Adjustable hours-back with Refresh button
- DataGrid with all metrics below the chart

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@erikdarlingdata erikdarlingdata merged commit 5fff833 into dev Mar 17, 2026
2 checks passed
@coderabbitai
Copy link

coderabbitai bot commented Mar 17, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 92d818f3-9fea-4290-82ca-db176da3fbfc

📥 Commits

Reviewing files that changed from the base of the PR and between c1aabc7 and 60edd37.

📒 Files selected for processing (7)
  • src/PlanViewer.App/Controls/QueryStoreGridControl.axaml
  • src/PlanViewer.App/Controls/QueryStoreGridControl.axaml.cs
  • src/PlanViewer.App/Dialogs/QueryStoreHistoryWindow.axaml
  • src/PlanViewer.App/Dialogs/QueryStoreHistoryWindow.axaml.cs
  • src/PlanViewer.App/PlanViewer.App.csproj
  • src/PlanViewer.Core/Models/QueryStoreHistoryRow.cs
  • src/PlanViewer.Core/Services/QueryStoreService.cs

📝 Walkthrough

Walkthrough

Introduces a new "Query Store History" feature enabling users to view historical query performance metrics. Adds a context menu option to open a new history window displaying performance data via chart and data grid, backed by a new service method fetching history from SQL Server and a data model for representing history rows.

Changes

Cohort / File(s) Summary
QueryStoreGridControl UI Updates
src/PlanViewer.App/Controls/QueryStoreGridControl.axaml, src/PlanViewer.App/Controls/QueryStoreGridControl.axaml.cs
Added "View History" context menu item with click handler that opens QueryStoreHistoryWindow with selected row data. Updated ContextMenu_Opening to enable the menu item when a row is selected.
QueryStoreHistoryWindow Component
src/PlanViewer.App/Dialogs/QueryStoreHistoryWindow.axaml, src/PlanViewer.App/Dialogs/QueryStoreHistoryWindow.axaml.cs
New window component displaying query history with metric selection, hours-back filtering, ScottPlot chart visualization with color-coded per-plan series, tooltip hover interactions, and data grid showing detailed performance metrics. Async data loading with error handling and status updates.
Data Model and Service
src/PlanViewer.Core/Models/QueryStoreHistoryRow.cs, src/PlanViewer.Core/Services/QueryStoreService.cs
New QueryStoreHistoryRow model with properties for plan identification, execution counts, and aggregated performance metrics. New FetchHistoryAsync service method retrieves historical stats from sys.query_store_runtime_stats via parameterized SQL query with configurable hours-back window.
Project Dependencies
src/PlanViewer.App/PlanViewer.App.csproj
Added ScottPlot.Avalonia NuGet package version 5.1.57 for chart visualization support.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/query-store-history
📝 Coding Plan
  • Generate coding plan for human review comments

Comment @coderabbitai help to get the list of available commands and usage tips.

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