using SQLInsight.Rules.Availability;
using SQLInsight.Rules.Concurrency;
using SQLInsight.Rules.Configuration;
using SQLInsight.Rules.Databases;
using SQLInsight.Rules.Engine;
using SQLInsight.Rules.Indexes;
using SQLInsight.Rules.Lifecycle;
using SQLInsight.Rules.Performance;
namespace SQLInsight.Rules;
public static class BuiltInRules
{
/// The rule pack behind the version rules; the embedded one if null.
public static IReadOnlyList Create(RuleKnowledge? knowledge = null)
{
knowledge ??= RuleKnowledge.Embedded();
return
[
// Version
new SupportLifecycleRule(knowledge),
new PatchLevelRule(knowledge),
// Configuration
new MaxServerMemoryDefaultRule(),
new MaxServerMemoryTooHighRule(),
new CostThresholdRule(),
new MaxDopRule(),
new OptimizeForAdHocRule(),
.. SimpleConfigurationRules.Create(),
new PendingConfigurationRule(),
new DeadlockTraceFlagRule(),
new ConfigurationChangedRule(),
// Databases
new DatabaseStateRule(),
.. SimpleDatabaseRules.Create(),
new CompatibilityLevelRule(),
new FullBackupRule(),
new LogBackupRule(),
new CheckDbRule(),
new SuspectPagesRule(),
new VirtualLogFileRule(),
new FileGrowthRule(),
new FileMaxSizeRule(),
new QueryStoreStateRule(),
new TempdbFilesRule(),
// Performance
.. WaitRules.Create(),
new DataFileReadLatencyRule(),
new LogFileWriteLatencyRule(),
new CpuRule(),
new MemoryGrantsPendingRule(),
new AnomalyRule(),
new PlanRegressionRule(),
new FailedForcedPlanRule(),
new ParameterSensitivityRule(),
new ImplicitConversionRule(),
new NoJoinPredicateRule(),
new ScalarUdfRule(),
new SpillRule(),
new ExcessiveGrantRule(),
// Indexes and statistics
new MissingIndexRule(),
new UnusedIndexRule(),
new DuplicateIndexRule(),
new ForwardedRecordsRule(),
new StaleStatisticsRule(),
new AutoStatisticsRule(),
// Availability and jobs
new AvailabilityGroupHealthRule(),
new AvailabilityGroupLagRule(),
new FailedJobRule(),
new AgentStoppedRule(),
// Concurrency
new BlockingRule(),
new DeadlockRule(),
];
}
}