Skip to content

Port ErikAI analysis engine to Dashboard (#590)#615

Merged
erikdarlingdata merged 1 commit intodevfrom
feature/dashboard-erikai-port-590
Mar 17, 2026
Merged

Port ErikAI analysis engine to Dashboard (#590)#615
erikdarlingdata merged 1 commit intodevfrom
feature/dashboard-erikai-port-590

Conversation

@erikdarlingdata
Copy link
Owner

@erikdarlingdata erikdarlingdata commented Mar 17, 2026

Summary

Full SQL Server port of the Lite ErikAI analysis engine. Dashboard now has the same inference engine, scoring, anomaly detection, self-sufficient drill-downs, and 6 MCP analysis tools.

Architecture

  • Portable (copied from Lite): AnalysisModels, IFactCollector, IPlanFetcher, InferenceEngine, RelationshipGraph, FactScorer — pure logic, no database dependency
  • SQL Server implementations (new): SqlServerFactCollector (23 collectors), SqlServerFindingStore, SqlServerAnomalyDetector, SqlServerDrillDownCollector, SqlServerPlanFetcher
  • MCP tools: analyze_server, get_analysis_facts, compare_analysis, audit_config, get_analysis_findings, mute_analysis_finding
  • Per-request AnalysisService: created from resolved server's connection string (Dashboard monitors multiple servers)

Key differences from Lite

  • Queries collect.* tables instead of DuckDB v_* views
  • No server_id filtering (each PerformanceMonitor database = one server)
  • SqlServerFindingStore auto-creates config.analysis_findings and config.analysis_muted tables
  • Uses DatabaseServiceRegistry for server resolution
  • Dashboard now has 63 total MCP tools

Test plan

  • dotnet build — 0 errors
  • Launch Dashboard, add sql2022, run analyze_server via MCP
  • Verify findings match Lite output for same server

Closes #590

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced automated performance analysis engine that detects anomalies, scores severity, and generates diagnostic findings for SQL Server instances.
    • Added server analysis tools for comparing performance periods, auditing configurations, and managing findings through muting/exclusion rules.
    • Enabled drill-down data enrichment with execution plan analysis and blocking/deadlock insights.
  • Documentation

    • Added diagnostic analysis tool references and updated workflow guidance.

Full SQL Server port of the Lite analysis engine. Dashboard now has
the same inference engine, scoring, anomaly detection, drill-downs,
and 6 MCP analysis tools as Lite.

Portable files (copied from Lite, namespace updated):
- AnalysisModels.cs, IFactCollector.cs, IPlanFetcher.cs
- InferenceEngine.cs, RelationshipGraph.cs, FactScorer.cs

SQL Server implementations (new):
- SqlServerFactCollector.cs — 23 fact collectors querying collect.* tables
- SqlServerFindingStore.cs — persists findings, auto-creates config.analysis_* tables
- SqlServerAnomalyDetector.cs — CPU/wait/blocking/IO anomaly detection
- SqlServerDrillDownCollector.cs — 11 drill-down categories
- SqlServerPlanFetcher.cs — on-demand plan fetch via sys.dm_exec_query_plan
- AnalysisService.cs — orchestrates pipeline with SQL Server backend

MCP tools (6 new):
- analyze_server, get_analysis_facts, compare_analysis
- audit_config, get_analysis_findings, mute_analysis_finding

Dashboard now has 63 total MCP tools (was 57).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Contributor

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: 22add272-3550-4218-848c-4975c3f9673b

📥 Commits

Reviewing files that changed from the base of the PR and between ba9b20c and bbe764d.

📒 Files selected for processing (16)
  • Dashboard/Analysis/AnalysisModels.cs
  • Dashboard/Analysis/AnalysisService.cs
  • Dashboard/Analysis/FactScorer.cs
  • Dashboard/Analysis/IFactCollector.cs
  • Dashboard/Analysis/IPlanFetcher.cs
  • Dashboard/Analysis/InferenceEngine.cs
  • Dashboard/Analysis/RelationshipGraph.cs
  • Dashboard/Analysis/SqlServerAnomalyDetector.cs
  • Dashboard/Analysis/SqlServerDrillDownCollector.cs
  • Dashboard/Analysis/SqlServerFactCollector.cs
  • Dashboard/Analysis/SqlServerFindingStore.cs
  • Dashboard/Analysis/SqlServerPlanFetcher.cs
  • Dashboard/Mcp/McpAnalysisTools.cs
  • Dashboard/Mcp/McpHostService.cs
  • Dashboard/Mcp/McpInstructions.cs
  • README.md

📝 Walkthrough

Walkthrough

This PR ports the ErikAI analysis engine from Lite to Dashboard by implementing SQL Server-specific components: fact collection, anomaly detection, drill-down enrichment, and persistence. Eight new service classes query collect.* tables, score and traverse facts to generate findings, and expose analysis endpoints via MCP integration.

Changes

Cohort / File(s) Summary
Data Models
Dashboard/Analysis/AnalysisModels.cs, Dashboard/Analysis/IFactCollector.cs, Dashboard/Analysis/IPlanFetcher.cs
Introduces eight model classes (Fact, AmplifierResult, Edge, AnalysisStory, AnalysisFinding, AnalysisMuted, AnalysisExclusion, AnalysisThreshold) and interfaces (IFactCollector, IPlanFetcher, AnalysisContext) for analysis pipeline structure and contracts.
Scoring & Inference
Dashboard/Analysis/FactScorer.cs, Dashboard/Analysis/RelationshipGraph.cs, Dashboard/Analysis/InferenceEngine.cs
Implements two-layer severity scoring with contextual amplifiers (FactScorer), conditional graph edges for fact relationships (RelationshipGraph), and greedy story generation via graph traversal (InferenceEngine).
SQL Server Data Access
Dashboard/Analysis/SqlServerFactCollector.cs, Dashboard/Analysis/SqlServerAnomalyDetector.cs, Dashboard/Analysis/SqlServerPlanFetcher.cs
SQL Server implementations for collecting diagnostic facts from collect.* tables, detecting anomalies via baseline comparison, and fetching execution plans; replaces Lite's DuckDB equivalents.
SQL Server Enrichment & Persistence
Dashboard/Analysis/SqlServerDrillDownCollector.cs, Dashboard/Analysis/SqlServerFindingStore.cs
Enriches high-severity findings with drill-down datasets (deadlocks, blocking chains, queries, plan analysis) and persists findings/mutes to SQL Server config schema tables.
Service Orchestration
Dashboard/Analysis/AnalysisService.cs
Central orchestrator that coordinates fact collection, anomaly detection, scoring, graph traversal, persistence, drill-down enrichment, and fires completion events with guarding against concurrent runs.
MCP Integration
Dashboard/Mcp/McpAnalysisTools.cs, Dashboard/Mcp/McpHostService.cs, Dashboard/Mcp/McpInstructions.cs
Exposes six analysis endpoints (analyze_server, get_analysis_facts, compare_analysis, audit_config, get_analysis_findings, mute_analysis_finding) via MCP; registers tools and updates workflow documentation.
Documentation
README.md
Cosmetic reformatting (headers, spacing, tables) without semantic content changes.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

The diff exhibits high complexity across multiple dimensions: SqlServerFactCollector (1,687 lines) with extensive parameterized SQL and fact aggregation, FactScorer (867 lines) with specialized per-metric scoring methods and amplifier logic, SqlServerAnomalyDetector (543 lines) with baseline-driven multi-metric anomaly detection, and orchestration logic spread across AnalysisService, InferenceEngine, and RelationshipGraph. Changes are heterogeneous—each SQL Server component requires independent reasoning about correctness of metric calculations, threshold logic, and data transformations. Graph-based inference and amplifier evaluation add domain-specific complexity. However, substantial portions follow repetitive patterns (fact emission, error handling, result mapping), which somewhat offsets cognitive load.

Possibly related PRs

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

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

@erikdarlingdata erikdarlingdata merged commit e858436 into dev Mar 17, 2026
3 of 4 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Mar 18, 2026
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