Skip to content

Commit fe6ce05

Browse files
Fix FinOps collector scheduling, server switch, and utilization bugs
- Add database_size_stats_collector and server_properties_collector to install seed data so fresh installs get FinOps collectors (fixes #531) - Load all per-server FinOps sub-tabs on server switch (fixes #530) - Clear stale utilization grids when switching servers (fixes #532) - Fix NoUtilizationMessage layout (RowSpan, alignment, margin) - Change CROSS JOIN to LEFT JOIN for server_info in Lite utilization query so data shows even without v_server_properties (fixes #533) - Remove stale debug JSON files Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1da0ceb commit fe6ce05

8 files changed

Lines changed: 43 additions & 158 deletions

File tree

Dashboard/Controls/FinOpsContent.xaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,10 +431,11 @@
431431

432432
<!-- Empty State -->
433433
<TextBlock x:Name="NoUtilizationMessage"
434-
Grid.Row="1" Grid.RowSpan="3"
434+
Grid.Row="1" Grid.RowSpan="4"
435435
Text="No utilization data collected yet. Select a server above."
436436
FontSize="14" Foreground="{DynamicResource ForegroundMutedBrush}"
437-
HorizontalAlignment="Center" VerticalAlignment="Center"
437+
HorizontalAlignment="Center" VerticalAlignment="Top"
438+
Margin="0,20,0,0"
438439
Visibility="Collapsed"/>
439440
</Grid>
440441
</TabItem>

Dashboard/Controls/FinOpsContent.xaml.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,13 @@ await Task.WhenAll(
102102
LoadDatabaseResourcesAsync(),
103103
LoadDatabaseSizesAsync(),
104104
LoadApplicationConnectionsAsync(),
105-
LoadServerInventoryAsync()
105+
LoadServerInventoryAsync(),
106+
LoadStorageGrowthAsync(),
107+
LoadIdleDatabasesAsync(),
108+
LoadTempdbSummaryAsync(),
109+
LoadWaitCategorySummaryAsync(),
110+
LoadExpensiveQueriesAsync(),
111+
LoadMemoryGrantEfficiencyAsync()
106112
);
107113
}
108114
catch (Exception ex)
@@ -133,6 +139,13 @@ private async Task LoadUtilizationAsync()
133139
DbSizeChart.ItemsSource = await _databaseService.GetFinOpsDatabaseSizeSummaryAsync();
134140
ProvisioningTrendGrid.ItemsSource = await _databaseService.GetFinOpsProvisioningTrendAsync();
135141
}
142+
else
143+
{
144+
TopTotalGrid.ItemsSource = null;
145+
TopAvgGrid.ItemsSource = null;
146+
DbSizeChart.ItemsSource = null;
147+
ProvisioningTrendGrid.ItemsSource = null;
148+
}
136149
}
137150
catch (Exception ex)
138151
{

Lite/Controls/FinOpsTab.xaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,10 +430,11 @@
430430

431431
<!-- Empty State -->
432432
<TextBlock x:Name="NoUtilizationMessage"
433-
Grid.Row="1" Grid.RowSpan="3"
433+
Grid.Row="1" Grid.RowSpan="4"
434434
Text="No utilization data collected yet. Select a server above."
435435
FontSize="14" Foreground="{DynamicResource ForegroundMutedBrush}"
436-
HorizontalAlignment="Center" VerticalAlignment="Center"
436+
HorizontalAlignment="Center" VerticalAlignment="Top"
437+
Margin="0,20,0,0"
437438
Visibility="Collapsed"/>
438439
</Grid>
439440
</TabItem>

Lite/Controls/FinOpsTab.xaml.cs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,18 @@ private async System.Threading.Tasks.Task LoadPerServerDataAsync()
108108
var serverId = GetSelectedServerId();
109109
if (serverId == 0 || _dataService == null) return;
110110

111-
await LoadUtilizationAsync(serverId);
112-
await LoadDatabaseResourcesAsync(serverId);
113-
await LoadApplicationConnectionsAsync(serverId);
114-
await LoadDatabaseSizesAsync(serverId);
111+
await System.Threading.Tasks.Task.WhenAll(
112+
LoadUtilizationAsync(serverId),
113+
LoadDatabaseResourcesAsync(serverId),
114+
LoadApplicationConnectionsAsync(serverId),
115+
LoadDatabaseSizesAsync(serverId),
116+
LoadStorageGrowthAsync(serverId),
117+
LoadIdleDatabasesAsync(serverId),
118+
LoadTempdbSummaryAsync(serverId),
119+
LoadWaitCategorySummaryAsync(serverId),
120+
LoadExpensiveQueriesAsync(serverId),
121+
LoadMemoryGrantEfficiencyAsync(serverId)
122+
);
115123
}
116124

117125
private async System.Threading.Tasks.Task LoadUtilizationAsync(int serverId)
@@ -132,6 +140,13 @@ private async System.Threading.Tasks.Task LoadUtilizationAsync(int serverId)
132140
DbSizeChart.ItemsSource = await _dataService.GetDatabaseSizeSummaryAsync(serverId);
133141
ProvisioningTrendGrid.ItemsSource = await _dataService.GetProvisioningTrendAsync(serverId);
134142
}
143+
else
144+
{
145+
TopTotalGrid.ItemsSource = null;
146+
TopAvgGrid.ItemsSource = null;
147+
DbSizeChart.ItemsSource = null;
148+
ProvisioningTrendGrid.ItemsSource = null;
149+
}
135150
}
136151
catch (Exception ex)
137152
{

Lite/Services/LocalDataService.FinOps.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ LIMIT 1
476476
s.cpu_count
477477
FROM cpu_stats c
478478
CROSS JOIN mem_latest m
479-
CROSS JOIN server_info s";
479+
LEFT JOIN server_info s ON true";
480480

481481
command.Parameters.Add(new DuckDBParameter { Value = serverId });
482482
command.Parameters.Add(new DuckDBParameter { Value = cutoff });

collection_schedule.json

Lines changed: 0 additions & 144 deletions
This file was deleted.

install/04_create_schedule_table.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ FROM
7474
(N'plan_cache_stats_collector', 1, 5, 5, 30, N'Plan cache composition statistics - single-use plans and plan cache bloat detection'),
7575
(N'session_stats_collector', 1, 1, 2, 30, N'Session and connection statistics - connection leaks and application patterns'),
7676
(N'waiting_tasks_collector', 1, 1, 2, 30, N'Currently waiting tasks - blocking chains and wait analysis'),
77-
(N'running_jobs_collector', 1, 1, 2, 7, N'Currently running SQL Agent jobs with historical duration comparison')
77+
(N'running_jobs_collector', 1, 1, 2, 7, N'Currently running SQL Agent jobs with historical duration comparison'),
78+
(N'database_size_stats_collector', 1, 60, 10, 90, N'Database file sizes for growth trending and capacity planning'),
79+
(N'server_properties_collector', 1, 1440, 5, 365, N'Server edition, licensing, CPU/memory hardware metadata for license audit')
7880
) AS v (collector_name, enabled, frequency_minutes, max_duration_minutes, retention_days, description)
7981
WHERE NOT EXISTS
8082
(

servers.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)