Skip to content

[FEATURE] add configurable cool-down option #443

@HannahVernon

Description

@HannahVernon

Which component(s) does this affect?

  • Full Dashboard
  • Lite
  • SQL collection scripts
  • Installer
  • Documentation

Problem Statement

The Dashboard and Lite apps currently use a hard-coded "cool down" period which limits the frequency of pop-up alerts and email alerts. This feature adds a user-configurable period via the Settings windows in each app.

Proposed Solution

Plan for branch: feature/add-cooldown-period-setting

The cooldown is currently private static readonly TimeSpan AlertCooldown = TimeSpan.FromMinutes(5) in both MainWindow.xaml.cs files (Dashboard line 63, Lite line 46). It's used at 7 comparison sites in each edition (one per alert type: blocking, deadlock, CPU, poison waits, long-running queries, TempDB space, long-running jobs).

What changes

Dashboard — uses UserPreferences for all alert settings:

  1. Dashboard/Models/UserPreferences.cs — add public int AlertCooldownMinutes { get; set; } = 5;
  2. Dashboard/MainWindow.xaml.cs — remove the static readonly field; introduce var alertCooldown = TimeSpan.FromMinutes(prefs.AlertCooldownMinutes); as a local at the top of EvaluateAlertConditionsAsync (where prefs is already fetched), replace all 7 AlertCooldown usages with it
  3. Dashboard/SettingsWindow.xaml — add AlertCooldownTextBox + label before the per-alert-type rows
  4. Dashboard/SettingsWindow.xaml.cs — load from prefs.AlertCooldownMinutes, save with 1–60 validation, restore default = 5

Lite — uses App.xaml.cs static properties + JSON:

  1. Lite/App.xaml.cs — add public static int AlertCooldownMinutes { get; set; } = 5;, load from alert_cooldown_minutes (clamped 1–60), save to JSON
  2. Lite/MainWindow.xaml.cs — remove static readonly field; add var alertCooldown = TimeSpan.FromMinutes(App.AlertCooldownMinutes); at top of CheckPerformanceAlerts, replace all 7 usages
  3. Lite/Windows/SettingsWindow.xaml — add AlertCooldownBox + label
  4. Lite/Windows/SettingsWindow.xaml.cs — load/save/restore pattern matching existing settings

One important non-change: GetFilteredDeadlockCountAsync has its own 5-minute SQL window — that's a data collection window, completely separate from the notification cooldown, and stays hardcoded.

Use Case

Personally, I would like to limit the frequency of alerts to be either:

(a) shorter to allow easier testing of changes to the alerts code
(b) allow the user to limit emails/alert popups to once per hour or whatever they think is helpful for their situation.

Alternatives Considered

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions