Dashboard: port CpuAlertMode (Total/SqlOnly) from Lite (#1004)#1006
Merged
Conversation
Mirrors PR #902's Lite changes into Dashboard so the desktop dashboard matches what the alert evaluates. Default is Total non-idle CPU. - UserPreferences: CpuAlertMode enum (Total/SqlOnly, default Total) with JsonStringEnumConverter so preferences.json stays readable. - Settings → Alerts: "measured as" dropdown next to CPU threshold. - ServerHealthStatus.CpuDisplayText now shows "Total% (SQL X%)" when both values are known, matching Lite's overview-card format. - High CPU alert evaluator: selects Total or SQL based on prefs and labels the metric in tray + email currentValue (e.g. "95% (Total CPU)"), mirroring the Lite fix that landed in PR #1005. - ResourceOverviewCpuChart now plots two series (SQL blue + Total orange), matching the Server Trends lanes change in PR #1005. - DatabaseService.GetDailySummaryAsync gains a CpuAlertMode parameter on the date-parameterized query path; DailySummaryContent reads the mode from prefs and passes it in. View path (used for today's no-date case and MCP) still uses SQL-only — separate follow-up tracks moving the view to total_cpu_utilization.
CREATE OR ALTER VIEW is re-run by the installer on every upgrade, so no migration is needed. With the Dashboard now defaulting CpuAlertMode to Total, the view's "today" no-date path (and MCP) now agree with the alert metric rather than reporting SQL-only counts. Users on SqlOnly mode still see Total-based counts on the no-date view path — the view can't be per-user since it's a database object. The date-parameterized path (DatabaseService.GetDailySummaryAsync with a date) honors per-user mode and is unchanged here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ports
CpuAlertModefrom Lite (PR #902) into Dashboard so the desktop dashboard's alert evaluator, overview card, chart, and email/tray text all agree on what "CPU" means. Default mode is Total non-idle CPU; users can flip to SQL Server only in Settings → Alerts.What's in here
UserPreferences.cs— newCpuAlertModeenum + property (defaultTotal).[JsonStringEnumConverter]keepspreferences.jsonreadable.SettingsWindow— "measured as" dropdown next to the CPU threshold (two options: total non-idle, SQL only).ServerHealthStatus.CpuDisplayText— now renders"Total% (SQL X%)"when both values are known, matching Lite's overview card format.MainWindow.CheckPerformanceAlerts(High CPU branch) — picks Total or SQL based on prefs; the tray notification text, theRecordAlertrow, the email'scurrentValue, and thedetailTextall carry theTotal CPU/SQL CPUqualifier (mirrors the Lite email-qualifier fix in PR Overview lanes: plot Total CPU alongside SQL CPU (#1004) #1005).ResourceOverviewCpuChart— plots two series (SQL blue + Total orange), matching the Server Trends lanes change in PR Overview lanes: plot Total CPU alongside SQL CPU (#1004) #1005.DatabaseService.GetDailySummaryAsync— date-parameterized path takes aCpuAlertModearg and swaps the column in thehigh_cpu_eventscount +CPU_CRITICALhealth check.DailySummaryContentreads the mode from prefs at refresh time.What's deferred (intentional)
The
report.daily_summaryview (install/47_create_reporting_views.sql:297) still hardcodessqlserver_cpu_utilization. It's hit when the daily-summary date picker is on "today" (the default landing case) and from MCP. Moving the view tototal_cpu_utilizationrequires an upgrade migration, so it's a separate bug. For non-today date selections, the inline query honors the user's mode.Test plan
preferences.json.Total CPU at N%(orSQL CPU at N%).N% (Total CPU)/N% (SQL CPU).SQL CPU %/Total CPU %.high_cpu_eventscount differs between Total and SqlOnly modes on a server with non-trivialother_process_cpu.94% (SQL 60%)when both values are present.Related to #1004. Companion to PR #1005 (lanes + Lite email qualifier).