Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Dashboard/Helpers/ChartHoverHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,9 @@ private void OnMouseMove(object sender, MouseEventArgs e)
try
{
var pos = e.GetPosition(_chart);
var dpi = VisualTreeHelper.GetDpi(_chart);
var pixel = new ScottPlot.Pixel(
(float)(pos.X * dpi.DpiScaleX),
(float)(pos.Y * dpi.DpiScaleY));
(float)(pos.X * _chart.DisplayScale),
(float)(pos.Y * _chart.DisplayScale));
var mouseCoords = _chart.Plot.GetCoordinates(pixel);

/* Use X-axis (time) proximity as the primary filter, Y-axis distance
Expand Down
13 changes: 0 additions & 13 deletions Installer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ static async Task<int> Main(string[] args)
Console.WriteLine(" -h, --help Show this help message");
Console.WriteLine(" --reinstall Drop existing database and perform clean install");
Console.WriteLine(" --reset-schedule Reset collection schedule to recommended defaults");
Console.WriteLine(" --preserve-jobs Keep existing SQL Agent jobs (owner, schedule, notifications)");
Console.WriteLine(" --encrypt=<level> Connection encryption: mandatory (default), optional, strict");
Console.WriteLine(" --trust-cert Trust server certificate without validation");
Console.WriteLine();
Expand All @@ -116,7 +115,6 @@ static async Task<int> Main(string[] args)
bool automatedMode = args.Length > 0;
bool reinstallMode = args.Any(a => a.Equals("--reinstall", StringComparison.OrdinalIgnoreCase));
bool resetSchedule = args.Any(a => a.Equals("--reset-schedule", StringComparison.OrdinalIgnoreCase));
bool preserveJobs = args.Any(a => a.Equals("--preserve-jobs", StringComparison.OrdinalIgnoreCase));
bool trustCert = args.Any(a => a.Equals("--trust-cert", StringComparison.OrdinalIgnoreCase));

/*Parse encryption option (default: Mandatory)*/
Expand All @@ -137,7 +135,6 @@ static async Task<int> Main(string[] args)
var filteredArgs = args
.Where(a => !a.Equals("--reinstall", StringComparison.OrdinalIgnoreCase))
.Where(a => !a.Equals("--reset-schedule", StringComparison.OrdinalIgnoreCase))
.Where(a => !a.Equals("--preserve-jobs", StringComparison.OrdinalIgnoreCase))
.Where(a => !a.Equals("--trust-cert", StringComparison.OrdinalIgnoreCase))
.Where(a => !a.StartsWith("--encrypt=", StringComparison.OrdinalIgnoreCase))
.ToArray();
Expand Down Expand Up @@ -656,16 +653,6 @@ INSERT...WHERE NOT EXISTS re-populates with current recommended values
Console.Write("(resetting schedule) ");
}

/*
Preserve existing SQL Agent jobs if requested — flip the T-SQL
variable so existing jobs are left untouched during upgrade
*/
if (preserveJobs && fileName.StartsWith("45_", StringComparison.Ordinal))
{
sqlContent = sqlContent.Replace("@preserve_jobs bit = 0", "@preserve_jobs bit = 1");
Console.Write("(preserving existing jobs) ");
}

/*
Remove SQLCMD directives (:r includes) as we're executing files directly
*/
Expand Down
6 changes: 0 additions & 6 deletions InstallerGui/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,6 @@
Margin="0,0,0,10"
Foreground="{DynamicResource ForegroundBrush}"/>

<!-- Preserve Jobs Checkbox -->
<CheckBox x:Name="PreserveJobsCheckBox"
Content="Keep existing SQL Agent jobs (owner, schedule, notifications)"
Margin="0,0,0,10"
Foreground="{DynamicResource ForegroundBrush}"/>

<!-- Validation Checkbox -->
<CheckBox x:Name="ValidationCheckBox"
Content="Run validation after install (recommended)"
Expand Down
2 changes: 0 additions & 2 deletions InstallerGui/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -401,13 +401,11 @@ Execute installation
Community dependencies install automatically before validation (98_validate)
*/
bool resetSchedule = ResetScheduleCheckBox.IsChecked == true;
bool preserveJobs = PreserveJobsCheckBox.IsChecked == true;
_installationResult = await InstallationService.ExecuteInstallationAsync(
_connectionString,
_sqlFiles,
isCleanInstall,
resetSchedule,
preserveJobs,
progress,
preValidationAction: async () =>
{
Expand Down
12 changes: 0 additions & 12 deletions InstallerGui/Services/InstallationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,6 @@ public static async Task<InstallationResult> ExecuteInstallationAsync(
List<string> sqlFiles,
bool cleanInstall,
bool resetSchedule = false,
bool preserveJobs = false,
IProgress<InstallationProgress>? progress = null,
Func<Task>? preValidationAction = null,
CancellationToken cancellationToken = default)
Expand Down Expand Up @@ -423,17 +422,6 @@ Execute SQL files
});
}

/*Preserve existing SQL Agent jobs if requested*/
if (preserveJobs && fileName.StartsWith("45_", StringComparison.Ordinal))
{
sqlContent = sqlContent.Replace("@preserve_jobs bit = 0", "@preserve_jobs bit = 1");
progress?.Report(new InstallationProgress
{
Message = "Preserving existing SQL Agent jobs...",
Status = "Info"
});
}

/*Remove SQLCMD directives*/
sqlContent = SqlCmdDirectivePattern.Replace(sqlContent, "");

Expand Down
5 changes: 2 additions & 3 deletions Lite/Helpers/ChartHoverHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,9 @@ private void OnMouseMove(object sender, MouseEventArgs e)
_lastUpdate = now;

var pos = e.GetPosition(_chart);
var dpi = VisualTreeHelper.GetDpi(_chart);
var pixel = new ScottPlot.Pixel(
(float)(pos.X * dpi.DpiScaleX),
(float)(pos.Y * dpi.DpiScaleY));
(float)(pos.X * _chart.DisplayScale),
(float)(pos.Y * _chart.DisplayScale));
var mouseCoords = _chart.Plot.GetCoordinates(pixel);

double bestDistance = double.MaxValue;
Expand Down
4 changes: 0 additions & 4 deletions install/01_install_database.sql
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,6 @@ BEGIN
DEFAULT 5,
retention_days integer NOT NULL
DEFAULT 30,
collect_query bit NOT NULL
DEFAULT CONVERT(bit, 'true'),
collect_plan bit NOT NULL
DEFAULT CONVERT(bit, 'true'),
[description] nvarchar(500) NULL,
created_date datetime2(7) NOT NULL
DEFAULT SYSDATETIME(),
Expand Down
28 changes: 4 additions & 24 deletions install/08_collect_query_stats.sql
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,16 @@ BEGIN
END;

/*
First run detection - collect last 1 hour of queries if this is the first execution
First run detection - collect all queries if this is the first execution
*/
IF NOT EXISTS (SELECT 1/0 FROM collect.query_stats)
AND NOT EXISTS (SELECT 1/0 FROM config.collection_log WHERE collector_name = N'query_stats_collector')
BEGIN
SET @cutoff_time = DATEADD(HOUR, -1, SYSDATETIME());
SET @cutoff_time = CONVERT(datetime2(7), '19000101');

IF @debug = 1
BEGIN
RAISERROR(N'First run detected - collecting last 1 hour of query stats', 0, 1) WITH NOWAIT;
RAISERROR(N'First run detected - collecting all queries from sys.dm_exec_query_stats', 0, 1) WITH NOWAIT;
END;
END;
ELSE
Expand Down Expand Up @@ -153,19 +153,6 @@ BEGIN
RAISERROR(N'Collecting queries executed since %s', 0, 1, @cutoff_time_string) WITH NOWAIT;
END;

/*
Read collection flags for query text and plans
*/
DECLARE
@collect_query bit = 1,
@collect_plan bit = 1;

SELECT
@collect_query = cs.collect_query,
@collect_plan = cs.collect_plan
FROM config.collection_schedule AS cs
WHERE cs.collector_name = N'query_stats_collector';

/*
Collect query statistics directly from DMV
Only collects queries executed since last collection
Expand Down Expand Up @@ -268,8 +255,6 @@ BEGIN
max_spills = qs.max_spills,
query_text =
CASE
WHEN @collect_query = 0
THEN NULL
WHEN qs.statement_start_offset = 0
AND qs.statement_end_offset = -1
THEN st.text
Expand All @@ -287,12 +272,7 @@ BEGIN
) / 2 + 1
)
END,
query_plan_text =
CASE
WHEN @collect_plan = 1
THEN tqp.query_plan
ELSE NULL
END
query_plan_text = tqp.query_plan
FROM sys.dm_exec_query_stats AS qs
OUTER APPLY sys.dm_exec_sql_text(qs.sql_handle) AS st
OUTER APPLY
Expand Down
38 changes: 6 additions & 32 deletions install/10_collect_procedure_stats.sql
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,16 @@ BEGIN
END;

/*
First run detection - collect last 1 hour of procedures if this is the first execution
First run detection - collect all procedures if this is the first execution
*/
IF NOT EXISTS (SELECT 1/0 FROM collect.procedure_stats)
AND NOT EXISTS (SELECT 1/0 FROM config.collection_log WHERE collector_name = N'procedure_stats_collector')
BEGIN
SET @cutoff_time = DATEADD(HOUR, -1, SYSDATETIME());
SET @cutoff_time = CONVERT(datetime2(7), '19000101');

IF @debug = 1
BEGIN
RAISERROR(N'First run detected - collecting last 1 hour of procedure stats', 0, 1) WITH NOWAIT;
RAISERROR(N'First run detected - collecting all procedures from sys.dm_exec_procedure_stats', 0, 1) WITH NOWAIT;
END;
END;
ELSE
Expand Down Expand Up @@ -153,17 +153,6 @@ BEGIN
RAISERROR(N'Collecting procedure stats with cutoff time: %s', 0, 1, @cutoff_time_string) WITH NOWAIT;
END;

/*
Read collection flag for plans
*/
DECLARE
@collect_plan bit = 1;

SELECT
@collect_plan = cs.collect_plan
FROM config.collection_schedule AS cs
WHERE cs.collector_name = N'procedure_stats_collector';

/*
Collect procedure, trigger, and function statistics
Single query with UNION ALL to collect from all three DMVs
Expand Down Expand Up @@ -234,12 +223,7 @@ BEGIN
total_spills = ps.total_spills,
min_spills = ps.min_spills,
max_spills = ps.max_spills,
query_plan_text =
CASE
WHEN @collect_plan = 1
THEN CONVERT(nvarchar(max), tqp.query_plan)
ELSE NULL
END
query_plan_text = CONVERT(nvarchar(max), tqp.query_plan)
FROM sys.dm_exec_procedure_stats AS ps
OUTER APPLY
sys.dm_exec_text_query_plan
Expand Down Expand Up @@ -402,12 +386,7 @@ BEGIN
total_spills = ts.total_spills,
min_spills = ts.min_spills,
max_spills = ts.max_spills,
query_plan_text =
CASE
WHEN @collect_plan = 1
THEN CONVERT(nvarchar(max), tqp.query_plan)
ELSE NULL
END
query_plan_text = CONVERT(nvarchar(max), tqp.query_plan)
FROM sys.dm_exec_trigger_stats AS ts
CROSS APPLY sys.dm_exec_sql_text(ts.sql_handle) AS st
OUTER APPLY
Expand Down Expand Up @@ -467,12 +446,7 @@ BEGIN
total_spills = NULL,
min_spills = NULL,
max_spills = NULL,
query_plan_text =
CASE
WHEN @collect_plan = 1
THEN CONVERT(nvarchar(max), tqp.query_plan)
ELSE NULL
END
query_plan_text = CONVERT(nvarchar(max), tqp.query_plan)
FROM sys.dm_exec_function_stats AS fs
OUTER APPLY
sys.dm_exec_text_query_plan
Expand Down
4 changes: 2 additions & 2 deletions install/18_collect_cpu_utilization_stats.sql
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ BEGIN
/*
Collect CPU utilization data from ring buffers
Only collects samples newer than the most recent sample we have
On first run (NULL max_sample_time), looks back 1 hour to populate initial data
On first run (NULL max_sample_time), looks back 7 days to populate initial data
Avoids duplicate collection of same ring buffer events
*/
INSERT INTO
Expand Down Expand Up @@ -156,7 +156,7 @@ BEGIN
SECOND,
-((@current_ms_ticks - t.timestamp) / 1000),
@start_time
) > ISNULL(@max_sample_time, DATEADD(HOUR, -1, @start_time))
) > ISNULL(@max_sample_time, DATEADD(DAY, -7, @start_time))
ORDER BY
t.timestamp DESC
OPTION(RECOMPILE);
Expand Down
6 changes: 3 additions & 3 deletions install/22_collect_blocked_processes.sql
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,17 @@ BEGIN
END;

/*
First run detection - collect last 1 hour of history if this is the first execution
First run detection - collect 3 days of history if this is the first execution
*/
IF NOT EXISTS (SELECT 1/0 FROM collect.blocked_process_xml)
AND NOT EXISTS (SELECT 1/0 FROM config.collection_log WHERE collector_name = N'blocked_process_xml_collector')
BEGIN
SET @minutes_back = 60; /*1 hour*/
SET @minutes_back = 4320; /*3 days*/
SET @cutoff_time = DATEADD(MINUTE, -@minutes_back, SYSUTCDATETIME());

IF @debug = 1
BEGIN
RAISERROR(N'First run detected - collecting last 1 hour of blocked process events', 0, 1) WITH NOWAIT;
RAISERROR(N'First run detected - collecting last 3 days of blocked process events', 0, 1) WITH NOWAIT;
END;
END;

Expand Down
6 changes: 3 additions & 3 deletions install/24_collect_deadlock_xml.sql
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,17 @@ BEGIN
END;

/*
First run detection - collect last 1 hour of history if this is the first execution
First run detection - collect 3 days of history if this is the first execution
*/
IF NOT EXISTS (SELECT 1/0 FROM collect.deadlock_xml)
AND NOT EXISTS (SELECT 1/0 FROM config.collection_log WHERE collector_name = N'deadlock_xml_collector')
BEGIN
SET @minutes_back = 60; /*1 hour*/
SET @minutes_back = 4320; /*3 days*/
SET @cutoff_time = DATEADD(MINUTE, -@minutes_back, SYSUTCDATETIME());

IF @debug = 1
BEGIN
RAISERROR(N'First run detected - collecting last 1 hour of deadlock events', 0, 1) WITH NOWAIT;
RAISERROR(N'First run detected - collecting last 3 days of deadlock events', 0, 1) WITH NOWAIT;
END;
END;

Expand Down
6 changes: 3 additions & 3 deletions install/28_collect_system_health_wrapper.sql
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,16 @@ BEGIN
END;

/*
First run detection - collect last 1 hour of history if this is the first execution
First run detection - collect 3 days of history if this is the first execution
*/
IF NOT EXISTS (SELECT 1/0 FROM config.collection_log WHERE collector_name = N'system_health_collector')
BEGIN
SET @hours_back = 1; /*1 hour*/
SET @hours_back = 72; /*3 days*/
SET @start_date = DATEADD(HOUR, -@hours_back, SYSDATETIMEOFFSET());

IF @debug = 1
BEGIN
RAISERROR(N'First run detected - collecting last 1 hour of system health data', 0, 1) WITH NOWAIT;
RAISERROR(N'First run detected - collecting last 3 days of system health data', 0, 1) WITH NOWAIT;
END;
END;

Expand Down
6 changes: 3 additions & 3 deletions install/29_collect_default_trace.sql
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,17 @@ BEGIN
END;

/*
First run detection - collect last 1 hour of trace data if this is the first execution
First run detection - collect all available trace data if this is the first execution
Ignore CONFIG_CHANGE entries when checking for first run (those are just from enabling the trace)
*/
IF NOT EXISTS (SELECT 1/0 FROM collect.default_trace_events)
AND NOT EXISTS (SELECT 1/0 FROM config.collection_log WHERE collector_name = N'default_trace_collector' AND collection_status = N'SUCCESS')
BEGIN
SET @cutoff_time = DATEADD(HOUR, -1, SYSDATETIME());
SET @cutoff_time = CONVERT(datetime2(7), '19000101');

IF @debug = 1
BEGIN
RAISERROR(N'First run detected - collecting last 1 hour of default trace events', 0, 1) WITH NOWAIT;
RAISERROR(N'First run detected - collecting all available default trace events', 0, 1) WITH NOWAIT;
END;
END;

Expand Down
Loading
Loading