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
253 changes: 250 additions & 3 deletions Darling/Darling.Tests/ViewerGridTimeColumnSortMemberTests.cs

Large diffs are not rendered by default.

438 changes: 438 additions & 0 deletions Darling/Darling.Tests/ViewerPostgresGridTimeTextTests.cs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Darling/PerformanceMonitor.Darling.Viewer/FinOpsTab.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@
<DataGrid x:Name="FinOpsProvisioningTrendGrid" Style="{StaticResource DarkGrid}" RowStyle="{StaticResource FinOpsRowStyle}"
CanUserSortColumns="False" MaxHeight="200">
<DataGrid.Columns>
<DataGridTextColumn Header="Day" Binding="{Binding DayDisplay}" Width="100"/>
<DataGridTextColumn Header="Day" Binding="{Binding DayDisplay}" Width="100" SortMemberPath="Day"/>
<DataGridTextColumn Header="Status" Binding="{Binding StatusDisplay}" Width="130">
<DataGridTextColumn.ElementStyle>
<Style TargetType="TextBlock">
Expand Down Expand Up @@ -822,7 +822,7 @@
<StackPanel>
<DataGrid x:Name="FinOpsMemoryGrantEfficiencyDataGrid" Style="{StaticResource DarkGrid}" RowStyle="{StaticResource FinOpsRowStyle}" MaxHeight="250">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding DayDisplay}" Width="100"><DataGridTextColumn.Header><StackPanel Orientation="Horizontal"><Button Style="{DynamicResource ColumnFilterButtonStyle}" Tag="DayDisplay" Click="FilterButton_Click" Margin="0,0,4,0"/><TextBlock Text="Day" FontWeight="Bold" VerticalAlignment="Center"/></StackPanel></DataGridTextColumn.Header></DataGridTextColumn>
<DataGridTextColumn Binding="{Binding DayDisplay}" Width="100" SortMemberPath="Day"><DataGridTextColumn.Header><StackPanel Orientation="Horizontal"><Button Style="{DynamicResource ColumnFilterButtonStyle}" Tag="DayDisplay" Click="FilterButton_Click" Margin="0,0,4,0"/><TextBlock Text="Day" FontWeight="Bold" VerticalAlignment="Center"/></StackPanel></DataGridTextColumn.Header></DataGridTextColumn>
<DataGridTextColumn Binding="{Binding AvgGrantedMb, StringFormat=N1}" Width="120" ElementStyle="{StaticResource NumericCell}"><DataGridTextColumn.Header><StackPanel Orientation="Horizontal"><Button Style="{DynamicResource ColumnFilterButtonStyle}" Tag="AvgGrantedMb" Click="FilterButton_Click" Margin="0,0,4,0"/><TextBlock Text="Avg Granted MB" FontWeight="Bold" VerticalAlignment="Center"/></StackPanel></DataGridTextColumn.Header></DataGridTextColumn>
<DataGridTextColumn Binding="{Binding AvgUsedMb, StringFormat=N1}" Width="110" ElementStyle="{StaticResource NumericCell}"><DataGridTextColumn.Header><StackPanel Orientation="Horizontal"><Button Style="{DynamicResource ColumnFilterButtonStyle}" Tag="AvgUsedMb" Click="FilterButton_Click" Margin="0,0,4,0"/><TextBlock Text="Avg Used MB" FontWeight="Bold" VerticalAlignment="Center"/></StackPanel></DataGridTextColumn.Header></DataGridTextColumn>
<DataGridTextColumn Binding="{Binding EfficiencyPct, StringFormat=N1}" Width="100" ElementStyle="{StaticResource NumericCell}"><DataGridTextColumn.Header><StackPanel Orientation="Horizontal"><Button Style="{DynamicResource ColumnFilterButtonStyle}" Tag="EfficiencyPct" Click="FilterButton_Click" Margin="0,0,4,0"/><TextBlock Text="Efficiency %" FontWeight="Bold" VerticalAlignment="Center"/></StackPanel></DataGridTextColumn.Header></DataGridTextColumn>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
</StackPanel>
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTextColumn Binding="{Binding LastSuccessfulRunLocal}" Width="150">
<DataGridTextColumn Binding="{Binding LastSuccessfulRunLocal}" Width="150" SortMemberPath="LastSuccessfulRunUtc">
<DataGridTextColumn.Header>
<StackPanel Orientation="Horizontal">
<Button Style="{DynamicResource ColumnFilterButtonStyle}" Tag="LastSuccessfulRunLocal" Click="FilterButton_Click" Margin="0,0,4,0"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<DataGridTextColumn Header="Metric" Binding="{Binding MetricName}" Width="130"/>
<DataGridTextColumn Header="Server" Binding="{Binding ServerName}" Width="130"/>
<DataGridTextColumn Header="Reason" Binding="{Binding Reason}" Width="*"/>
<DataGridTextColumn Header="Expires" Binding="{Binding ExpiresDisplay}" Width="140"/>
<DataGridTextColumn Header="Expires" Binding="{Binding ExpiresDisplay}" Width="140" SortMemberPath="ExpiresAtUtc"/>
</DataGrid.Columns>
</DataGrid>
<TextBlock x:Name="NoRulesMessage"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@
ContextMenu="{StaticResource DataGridContextMenu}">
<DataGrid.Columns>
<DataGridTextColumn Header="Collection Time" Binding="{Binding CollectionTimeLocal}" SortMemberPath="CollectionTime" SortDirection="Descending" Width="130"/>
<DataGridTextColumn Header="Last Execution" Binding="{Binding LastExecutionTimeLocal}" Width="130"/>
<DataGridTextColumn Header="Cached Time" Binding="{Binding CachedTimeLocal}" Width="130"/>
<DataGridTextColumn Header="Last Execution" Binding="{Binding LastExecutionTimeLocal}" Width="130" SortMemberPath="LastExecutionTime"/>
<DataGridTextColumn Header="Cached Time" Binding="{Binding CachedTimeLocal}" Width="130" SortMemberPath="CachedTime"/>
<DataGridTemplateColumn Header="Plan" Width="Auto" MinWidth="80">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@
ContextMenu="{StaticResource DataGridContextMenu}">
<DataGrid.Columns>
<DataGridTextColumn Header="Collection Time" Binding="{Binding CollectionTimeLocal}" SortMemberPath="CollectionTime" SortDirection="Descending" Width="130"/>
<DataGridTextColumn Header="Last Execution" Binding="{Binding LastExecutionTimeLocal}" Width="130"/>
<DataGridTextColumn Header="Creation Time" Binding="{Binding CreationTimeLocal}" Width="130"/>
<DataGridTextColumn Header="Last Execution" Binding="{Binding LastExecutionTimeLocal}" Width="130" SortMemberPath="LastExecutionTime"/>
<DataGridTextColumn Header="Creation Time" Binding="{Binding CreationTimeLocal}" Width="130" SortMemberPath="CreationTime"/>
<DataGridTemplateColumn Header="Plan" Width="Auto" MinWidth="80">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ public sealed class PostgresCollectorHealthRow
public string StoreTable { get; init; } = "";
public string Status { get; init; } = "";
public string LastRun { get; init; } = "";
/// <summary>The UTC instant <see cref="LastRun"/> is formatted from. The column sorts by it, not by that text.</summary>
public DateTime? LastRunUtc { get; init; }
public long Runs { get; init; }
public long FailedRuns { get; init; }
public long RowsCollected { get; init; }
Expand Down Expand Up @@ -215,6 +217,7 @@ public static List<PostgresCollectorHealthRow> BuildPostgresCollectorHealth(
LastRun = facts?.LastRunAt is { } at
? ViewerTimeHelper.FormatForDisplay(at, "yyyy-MM-dd HH:mm")
: "",
LastRunUtc = facts?.LastRunAt,
Runs = facts?.Runs ?? 0,
FailedRuns = facts?.FailedRuns ?? 0,
RowsCollected = facts?.RowsCollected ?? 0,
Expand Down Expand Up @@ -344,6 +347,8 @@ confusing of the two. */
public sealed record PgCpuUtilizationRow
{
public required string Time { get; init; }
/// <summary>The UTC instant <see cref="Time"/> is formatted from. The column sorts by it, not by that text.</summary>
public DateTime SampleTimeUtc { get; init; }
public required double CpuPercent { get; init; }
}

Expand All @@ -358,6 +363,7 @@ public async Task<List<PgCpuUtilizationRow>> GetPgCpuUtilizationHistoryAsync(
.Select(s => new PgCpuUtilizationRow
{
Time = ViewerTimeHelper.FormatForDisplay(s.SampleTimeUtc, "yyyy-MM-dd HH:mm"),
SampleTimeUtc = s.SampleTimeUtc,
CpuPercent = s.CpuPercent,
})
.ToList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public static string Local(DateTime? utc) =>
public sealed class SchedulerIssueRow(SchedulerIssueRecord record)
{
public string EventTimeLocal => SystemEventRowFormat.Local(record.EventTime);
/// <summary>Raw naive-UTC event time (the XE @timestamp): the instant <see cref="EventTimeLocal"/> is formatted from. The Event Time column sorts by it, so the grid orders by time and not by that text.</summary>
public DateTime? EventTime => record.EventTime;
public int? SqlCpuUtilization => record.SqlCpuUtilization;
public int? OtherProcessCpu => record.OtherProcessCpu;
public int? SystemIdle => record.SystemIdle;
Expand All @@ -79,6 +81,8 @@ public sealed class SchedulerIssueRow(SchedulerIssueRecord record)
public sealed class SevereErrorRow(SevereErrorRecord record, string databaseName)
{
public string EventTimeLocal => SystemEventRowFormat.Local(record.EventTime);
/// <summary>Raw naive-UTC event time (the XE @timestamp): the instant <see cref="EventTimeLocal"/> is formatted from. The Event Time column sorts by it, so the grid orders by time and not by that text.</summary>
public DateTime? EventTime => record.EventTime;
public int? ErrorNumber => record.ErrorNumber;
public int? Severity => record.Severity;
public int? State => record.State;
Expand All @@ -91,6 +95,8 @@ public sealed class SevereErrorRow(SevereErrorRecord record, string databaseName
public sealed class MemoryConditionsRow(MemoryConditionsRecord record)
{
public string EventTimeLocal => SystemEventRowFormat.Local(record.EventTime);
/// <summary>Raw naive-UTC event time (the XE @timestamp): the instant <see cref="EventTimeLocal"/> is formatted from. The Event Time column sorts by it, so the grid orders by time and not by that text.</summary>
public DateTime? EventTime => record.EventTime;
public string? LastNotification => record.LastNotification;
public long? OutOfMemoryExceptions => record.OutOfMemoryExceptions;
public bool? IsAnyPoolOutOfMemory => record.IsAnyPoolOutOfMemory;
Expand Down Expand Up @@ -128,6 +134,8 @@ public sealed class MemoryConditionsRow(MemoryConditionsRecord record)
public sealed class MemoryBrokerRow(MemoryBrokerRecord record)
{
public string EventTimeLocal => SystemEventRowFormat.Local(record.EventTime);
/// <summary>Raw naive-UTC event time (the XE @timestamp): the instant <see cref="EventTimeLocal"/> is formatted from. The Event Time column sorts by it, so the grid orders by time and not by that text.</summary>
public DateTime? EventTime => record.EventTime;
public long? BrokerId => record.BrokerId;
public long? PoolMetadataId => record.PoolMetadataId;
public long? DeltaTime => record.DeltaTime;
Expand All @@ -146,6 +154,8 @@ public sealed class MemoryBrokerRow(MemoryBrokerRecord record)
public sealed class MemoryNodeOomRow(MemoryNodeOomRecord record)
{
public string EventTimeLocal => SystemEventRowFormat.Local(record.EventTime);
/// <summary>Raw naive-UTC event time (the XE @timestamp): the instant <see cref="EventTimeLocal"/> is formatted from. The Event Time column sorts by it, so the grid orders by time and not by that text.</summary>
public DateTime? EventTime => record.EventTime;
public long? NodeId => record.NodeId;
public long? MemoryNodeId => record.MemoryNodeId;
public long? MemoryUtilizationPct => record.MemoryUtilizationPct;
Expand Down Expand Up @@ -179,6 +189,8 @@ public sealed class MemoryNodeOomRow(MemoryNodeOomRecord record)
public sealed class SignificantWaitRow(SignificantWaitRecord record)
{
public string EventTimeLocal => SystemEventRowFormat.Local(record.EventTime);
/// <summary>Raw naive-UTC event time (the XE @timestamp): the instant <see cref="EventTimeLocal"/> is formatted from. The Event Time column sorts by it, so the grid orders by time and not by that text.</summary>
public DateTime? EventTime => record.EventTime;
public string? WaitType => record.WaitType;
public long? DurationMs => record.DurationMs;
public long? SignalDurationMs => record.SignalDurationMs;
Expand All @@ -191,6 +203,8 @@ public sealed class SignificantWaitRow(SignificantWaitRecord record)
public sealed class CpuTasksRow(CpuTasksRecord record)
{
public string EventTimeLocal => SystemEventRowFormat.Local(record.EventTime);
/// <summary>Raw naive-UTC event time (the XE @timestamp): the instant <see cref="EventTimeLocal"/> is formatted from. The Event Time column sorts by it, so the grid orders by time and not by that text.</summary>
public DateTime? EventTime => record.EventTime;
public string? State => record.State;
public long? MaxWorkers => record.MaxWorkers;
public long? WorkersCreated => record.WorkersCreated;
Expand All @@ -207,6 +221,8 @@ public sealed class CpuTasksRow(CpuTasksRecord record)
public sealed class IoIssuesRow(IoIssuesRecord record)
{
public string EventTimeLocal => SystemEventRowFormat.Local(record.EventTime);
/// <summary>Raw naive-UTC event time (the XE @timestamp): the instant <see cref="EventTimeLocal"/> is formatted from. The Event Time column sorts by it, so the grid orders by time and not by that text.</summary>
public DateTime? EventTime => record.EventTime;
public string? State => record.State;
public long? IoLatchTimeouts => record.IoLatchTimeouts;
public long? IntervalLongIos => record.IntervalLongIos;
Expand Down
Loading
Loading