Skip to content

Commit 10c67fc

Browse files
Merge pull request #406 from erikdarlingdata/release/v2.1.0
Merge main into dev for v2.1.0 release
2 parents b18945d + 842dc68 commit 10c67fc

15 files changed

Lines changed: 135 additions & 253 deletions

Dashboard/Helpers/ChartHoverHelper.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,9 @@ private void OnMouseMove(object sender, MouseEventArgs e)
7171
try
7272
{
7373
var pos = e.GetPosition(_chart);
74-
var dpi = VisualTreeHelper.GetDpi(_chart);
7574
var pixel = new ScottPlot.Pixel(
76-
(float)(pos.X * dpi.DpiScaleX),
77-
(float)(pos.Y * dpi.DpiScaleY));
75+
(float)(pos.X * _chart.DisplayScale),
76+
(float)(pos.Y * _chart.DisplayScale));
7877
var mouseCoords = _chart.Plot.GetCoordinates(pixel);
7978

8079
/* Use X-axis (time) proximity as the primary filter, Y-axis distance

Installer/Program.cs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ static async Task<int> Main(string[] args)
9595
Console.WriteLine(" -h, --help Show this help message");
9696
Console.WriteLine(" --reinstall Drop existing database and perform clean install");
9797
Console.WriteLine(" --reset-schedule Reset collection schedule to recommended defaults");
98-
Console.WriteLine(" --preserve-jobs Keep existing SQL Agent jobs (owner, schedule, notifications)");
9998
Console.WriteLine(" --encrypt=<level> Connection encryption: mandatory (default), optional, strict");
10099
Console.WriteLine(" --trust-cert Trust server certificate without validation");
101100
Console.WriteLine();
@@ -116,7 +115,6 @@ static async Task<int> Main(string[] args)
116115
bool automatedMode = args.Length > 0;
117116
bool reinstallMode = args.Any(a => a.Equals("--reinstall", StringComparison.OrdinalIgnoreCase));
118117
bool resetSchedule = args.Any(a => a.Equals("--reset-schedule", StringComparison.OrdinalIgnoreCase));
119-
bool preserveJobs = args.Any(a => a.Equals("--preserve-jobs", StringComparison.OrdinalIgnoreCase));
120118
bool trustCert = args.Any(a => a.Equals("--trust-cert", StringComparison.OrdinalIgnoreCase));
121119

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

659-
/*
660-
Preserve existing SQL Agent jobs if requested — flip the T-SQL
661-
variable so existing jobs are left untouched during upgrade
662-
*/
663-
if (preserveJobs && fileName.StartsWith("45_", StringComparison.Ordinal))
664-
{
665-
sqlContent = sqlContent.Replace("@preserve_jobs bit = 0", "@preserve_jobs bit = 1");
666-
Console.Write("(preserving existing jobs) ");
667-
}
668-
669656
/*
670657
Remove SQLCMD directives (:r includes) as we're executing files directly
671658
*/

InstallerGui/MainWindow.xaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,6 @@
186186
Margin="0,0,0,10"
187187
Foreground="{DynamicResource ForegroundBrush}"/>
188188

189-
<!-- Preserve Jobs Checkbox -->
190-
<CheckBox x:Name="PreserveJobsCheckBox"
191-
Content="Keep existing SQL Agent jobs (owner, schedule, notifications)"
192-
Margin="0,0,0,10"
193-
Foreground="{DynamicResource ForegroundBrush}"/>
194-
195189
<!-- Validation Checkbox -->
196190
<CheckBox x:Name="ValidationCheckBox"
197191
Content="Run validation after install (recommended)"

InstallerGui/MainWindow.xaml.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,13 +401,11 @@ Execute installation
401401
Community dependencies install automatically before validation (98_validate)
402402
*/
403403
bool resetSchedule = ResetScheduleCheckBox.IsChecked == true;
404-
bool preserveJobs = PreserveJobsCheckBox.IsChecked == true;
405404
_installationResult = await InstallationService.ExecuteInstallationAsync(
406405
_connectionString,
407406
_sqlFiles,
408407
isCleanInstall,
409408
resetSchedule,
410-
preserveJobs,
411409
progress,
412410
preValidationAction: async () =>
413411
{

InstallerGui/Services/InstallationService.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,6 @@ public static async Task<InstallationResult> ExecuteInstallationAsync(
325325
List<string> sqlFiles,
326326
bool cleanInstall,
327327
bool resetSchedule = false,
328-
bool preserveJobs = false,
329328
IProgress<InstallationProgress>? progress = null,
330329
Func<Task>? preValidationAction = null,
331330
CancellationToken cancellationToken = default)
@@ -423,17 +422,6 @@ Execute SQL files
423422
});
424423
}
425424

426-
/*Preserve existing SQL Agent jobs if requested*/
427-
if (preserveJobs && fileName.StartsWith("45_", StringComparison.Ordinal))
428-
{
429-
sqlContent = sqlContent.Replace("@preserve_jobs bit = 0", "@preserve_jobs bit = 1");
430-
progress?.Report(new InstallationProgress
431-
{
432-
Message = "Preserving existing SQL Agent jobs...",
433-
Status = "Info"
434-
});
435-
}
436-
437425
/*Remove SQLCMD directives*/
438426
sqlContent = SqlCmdDirectivePattern.Replace(sqlContent, "");
439427

Lite/Helpers/ChartHoverHelper.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,9 @@ private void OnMouseMove(object sender, MouseEventArgs e)
6969
_lastUpdate = now;
7070

7171
var pos = e.GetPosition(_chart);
72-
var dpi = VisualTreeHelper.GetDpi(_chart);
7372
var pixel = new ScottPlot.Pixel(
74-
(float)(pos.X * dpi.DpiScaleX),
75-
(float)(pos.Y * dpi.DpiScaleY));
73+
(float)(pos.X * _chart.DisplayScale),
74+
(float)(pos.Y * _chart.DisplayScale));
7675
var mouseCoords = _chart.Plot.GetCoordinates(pixel);
7776

7877
double bestDistance = double.MaxValue;

install/01_install_database.sql

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,6 @@ BEGIN
274274
DEFAULT 5,
275275
retention_days integer NOT NULL
276276
DEFAULT 30,
277-
collect_query bit NOT NULL
278-
DEFAULT CONVERT(bit, 'true'),
279-
collect_plan bit NOT NULL
280-
DEFAULT CONVERT(bit, 'true'),
281277
[description] nvarchar(500) NULL,
282278
created_date datetime2(7) NOT NULL
283279
DEFAULT SYSDATETIME(),

install/08_collect_query_stats.sql

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,16 @@ BEGIN
107107
END;
108108

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

117117
IF @debug = 1
118118
BEGIN
119-
RAISERROR(N'First run detected - collecting last 1 hour of query stats', 0, 1) WITH NOWAIT;
119+
RAISERROR(N'First run detected - collecting all queries from sys.dm_exec_query_stats', 0, 1) WITH NOWAIT;
120120
END;
121121
END;
122122
ELSE
@@ -153,19 +153,6 @@ BEGIN
153153
RAISERROR(N'Collecting queries executed since %s', 0, 1, @cutoff_time_string) WITH NOWAIT;
154154
END;
155155

156-
/*
157-
Read collection flags for query text and plans
158-
*/
159-
DECLARE
160-
@collect_query bit = 1,
161-
@collect_plan bit = 1;
162-
163-
SELECT
164-
@collect_query = cs.collect_query,
165-
@collect_plan = cs.collect_plan
166-
FROM config.collection_schedule AS cs
167-
WHERE cs.collector_name = N'query_stats_collector';
168-
169156
/*
170157
Collect query statistics directly from DMV
171158
Only collects queries executed since last collection
@@ -268,8 +255,6 @@ BEGIN
268255
max_spills = qs.max_spills,
269256
query_text =
270257
CASE
271-
WHEN @collect_query = 0
272-
THEN NULL
273258
WHEN qs.statement_start_offset = 0
274259
AND qs.statement_end_offset = -1
275260
THEN st.text
@@ -287,12 +272,7 @@ BEGIN
287272
) / 2 + 1
288273
)
289274
END,
290-
query_plan_text =
291-
CASE
292-
WHEN @collect_plan = 1
293-
THEN tqp.query_plan
294-
ELSE NULL
295-
END
275+
query_plan_text = tqp.query_plan
296276
FROM sys.dm_exec_query_stats AS qs
297277
OUTER APPLY sys.dm_exec_sql_text(qs.sql_handle) AS st
298278
OUTER APPLY

install/10_collect_procedure_stats.sql

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,16 @@ BEGIN
107107
END;
108108

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

117117
IF @debug = 1
118118
BEGIN
119-
RAISERROR(N'First run detected - collecting last 1 hour of procedure stats', 0, 1) WITH NOWAIT;
119+
RAISERROR(N'First run detected - collecting all procedures from sys.dm_exec_procedure_stats', 0, 1) WITH NOWAIT;
120120
END;
121121
END;
122122
ELSE
@@ -153,17 +153,6 @@ BEGIN
153153
RAISERROR(N'Collecting procedure stats with cutoff time: %s', 0, 1, @cutoff_time_string) WITH NOWAIT;
154154
END;
155155

156-
/*
157-
Read collection flag for plans
158-
*/
159-
DECLARE
160-
@collect_plan bit = 1;
161-
162-
SELECT
163-
@collect_plan = cs.collect_plan
164-
FROM config.collection_schedule AS cs
165-
WHERE cs.collector_name = N'procedure_stats_collector';
166-
167156
/*
168157
Collect procedure, trigger, and function statistics
169158
Single query with UNION ALL to collect from all three DMVs
@@ -234,12 +223,7 @@ BEGIN
234223
total_spills = ps.total_spills,
235224
min_spills = ps.min_spills,
236225
max_spills = ps.max_spills,
237-
query_plan_text =
238-
CASE
239-
WHEN @collect_plan = 1
240-
THEN CONVERT(nvarchar(max), tqp.query_plan)
241-
ELSE NULL
242-
END
226+
query_plan_text = CONVERT(nvarchar(max), tqp.query_plan)
243227
FROM sys.dm_exec_procedure_stats AS ps
244228
OUTER APPLY
245229
sys.dm_exec_text_query_plan
@@ -402,12 +386,7 @@ BEGIN
402386
total_spills = ts.total_spills,
403387
min_spills = ts.min_spills,
404388
max_spills = ts.max_spills,
405-
query_plan_text =
406-
CASE
407-
WHEN @collect_plan = 1
408-
THEN CONVERT(nvarchar(max), tqp.query_plan)
409-
ELSE NULL
410-
END
389+
query_plan_text = CONVERT(nvarchar(max), tqp.query_plan)
411390
FROM sys.dm_exec_trigger_stats AS ts
412391
CROSS APPLY sys.dm_exec_sql_text(ts.sql_handle) AS st
413392
OUTER APPLY
@@ -467,12 +446,7 @@ BEGIN
467446
total_spills = NULL,
468447
min_spills = NULL,
469448
max_spills = NULL,
470-
query_plan_text =
471-
CASE
472-
WHEN @collect_plan = 1
473-
THEN CONVERT(nvarchar(max), tqp.query_plan)
474-
ELSE NULL
475-
END
449+
query_plan_text = CONVERT(nvarchar(max), tqp.query_plan)
476450
FROM sys.dm_exec_function_stats AS fs
477451
OUTER APPLY
478452
sys.dm_exec_text_query_plan

install/18_collect_cpu_utilization_stats.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ BEGIN
112112
/*
113113
Collect CPU utilization data from ring buffers
114114
Only collects samples newer than the most recent sample we have
115-
On first run (NULL max_sample_time), looks back 1 hour to populate initial data
115+
On first run (NULL max_sample_time), looks back 7 days to populate initial data
116116
Avoids duplicate collection of same ring buffer events
117117
*/
118118
INSERT INTO
@@ -156,7 +156,7 @@ BEGIN
156156
SECOND,
157157
-((@current_ms_ticks - t.timestamp) / 1000),
158158
@start_time
159-
) > ISNULL(@max_sample_time, DATEADD(HOUR, -1, @start_time))
159+
) > ISNULL(@max_sample_time, DATEADD(DAY, -7, @start_time))
160160
ORDER BY
161161
t.timestamp DESC
162162
OPTION(RECOMPILE);

0 commit comments

Comments
 (0)