A one-minute collector reads open user transactions (age, log bytes used
and reserved, database, session, login, program, statement) and user
requests running longer than the threshold, leaving out the agent's own
and system sessions, BACKUP/RESTORE/DBCC (long operations) and requests
waiting on purpose. Transactions open a minute or holding 100 MB are kept
in insight.LongTransactions (migration 0014, RawDays).
Rules SQLI-TRAN-001 (open > 10 min, High at 6x), SQLI-TRAN-002 (> 1 GB
log) and SQLI-REQ-001 (statement > 15 min), configurable under
SQLInsight:Activity. Shown "right now" on the instance page and in the
time window analysis and PDF; GET /api/v1/instances/{name}/activity and
the analysis JSON leave logins and statements out.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
23 lines
676 B
C#
23 lines
676 B
C#
using SQLInsight.Rules.Engine;
|
|
|
|
namespace SQLInsight.Rules.Tests;
|
|
|
|
public class RuleCatalogTests
|
|
{
|
|
[Fact]
|
|
public void Every_rule_has_a_unique_well_formed_id()
|
|
{
|
|
var rules = BuiltInRules.Create();
|
|
|
|
Assert.Equal(rules.Count, rules.Select(r => r.Id).Distinct(StringComparer.OrdinalIgnoreCase).Count());
|
|
Assert.All(rules, r => Assert.Matches("^SQLI-[A-Z]+-[0-9]{3}$", r.Id));
|
|
Assert.All(rules, r => Assert.False(string.IsNullOrWhiteSpace(r.Title)));
|
|
}
|
|
|
|
/// <summary>Keeps the rule count in the README honest.</summary>
|
|
[Fact]
|
|
public void Rule_count()
|
|
{
|
|
Assert.Equal(75, BuiltInRules.Create().Count);
|
|
}
|
|
}
|