Skip to content

PerformanceMonitor never runs the plan BenefitScorer, so findings get no benefit score and the scorer's wait findings never appear #4546

Description

@erikdarlingdata

Claude posting for Erik Darling

PerformanceMonitor never runs BenefitScorer, so no plan finding gets a benefit score, and the scorer's own findings never appear.

Seen

BenefitScorer.Score(ParsedPlan) (PerformanceMonitor.PlanAnalysis/BenefitScorer.cs) exists, and its own doc comment says it "runs after PlanAnalyzer.Analyze()". But no product code calls it. git grep -n "BenefitScorer.Score" -- '*.cs' ':!*Tests*' finds nothing. Every entry point runs only the analyzer:

Entry point File Runs on
Darling analysis pass (plan advisories) PerformanceMonitor.PlanAnalysis/PlanAdvisoryAggregator.cs ~58 service thread pool
Darling drill-down plans Darling/PerformanceMonitor.Darling.Analysis/PgDrillDownCollector.Plans.cs ~79 service thread pool
MCP plan tools PerformanceMonitor.PlanAnalysis/McpPlanAnalysisFormatter.cs ~98 web host
Lite drill-down Lite/Analysis/DrillDownCollector.Plans.cs ~77 Lite
Plan viewer PerformanceMonitor.Ui/PlanViewerControl.xaml.cs ~119 UI thread

So PlanWarning.MaxBenefitPercent and PlanStatement.WaitBenefits are always empty. Nothing reads them in the viewer, MCP output or Lite either.

Why it matters now

The plan-analysis sync (#4511) ports PerformanceStudio changes that live in the scorer, and none of them has any effect in PM until the scorer runs:

PerformanceStudio runs both steps in one place (PlanAnalysisPipeline: analyze, then score).

Fix shape

Run BenefitScorer.Score(plan) right after PlanAnalyzer.Analyze(plan) at each entry point above, or through one shared analyze-then-score helper like PerformanceStudio's. Then decide whether the viewer and the MCP output show each finding's benefit. The deep-plan stack fix (#4512) covers the scorer's recursion too.

Activity

  1. erikdarlingdata commented on Sep 28, 2026

    @erikdarlingdata
    OwnerAuthor

    Claude posting for Erik Darling.

    Fixed by #4552 (586b27a), so this issue is closing. PlanAnalysisPipeline.Run runs the analyzer and then BenefitScorer.Score at all five entry points, so findings now carry a benefit value. The MCP plan tools report max_benefit_percent and order findings by it, and the plan viewer orders warnings the same way with a "— up to X% benefit" header, as PerformanceStudio does. Stored plan advisory counts are unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions