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
16 changes: 12 additions & 4 deletions Lite/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,9 @@
allWaitNames,
$"{App.AlertPoisonWaitThresholdMs}ms avg",
summary.ServerId,
poisonContext);
poisonContext,
numericCurrentValue: worst.AvgMsPerWait,
numericThresholdValue: App.AlertPoisonWaitThresholdMs);
}
}
else if (_activePoisonWaitAlert.TryGetValue(key, out var wasPoisonWait) && wasPoisonWait)
Expand Down Expand Up @@ -1147,7 +1149,9 @@
$"{longRunning.Count} query(s), longest {elapsedMinutes}m",
$"{App.AlertLongRunningQueryThresholdMinutes}m",
summary.ServerId,
lrqContext);
lrqContext,
numericCurrentValue: elapsedMinutes,
numericThresholdValue: App.AlertLongRunningQueryThresholdMinutes);
}
}
else if (_activeLongRunningQueryAlert.TryGetValue(key, out var wasLongRunning) && wasLongRunning)
Expand Down Expand Up @@ -1191,7 +1195,9 @@
$"{tempDb.UsedPercent:F0}% used ({tempDb.TotalReservedMb:F0} MB)",
$"{App.AlertTempDbSpaceThresholdPercent}%",
summary.ServerId,
tempDbContext);
tempDbContext,
numericCurrentValue: tempDb.UsedPercent,
numericThresholdValue: App.AlertTempDbSpaceThresholdPercent);
}
}
else if (_activeTempDbSpaceAlert.TryGetValue(key, out var wasTempDb) && wasTempDb)
Expand Down Expand Up @@ -1240,7 +1246,9 @@
$"{anomalousJobs.Count} job(s) exceeding {App.AlertLongRunningJobMultiplier}x average",
$"{App.AlertLongRunningJobMultiplier}x historical avg",
summary.ServerId,
jobContext);
jobContext,
numericCurrentValue: (double)worst.PercentOfAverage,

Check warning on line 1250 in Lite/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / build

Nullable value type may be null.

Check warning on line 1250 in Lite/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / build

Nullable value type may be null.

Check warning on line 1250 in Lite/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / build

Nullable value type may be null.

Check warning on line 1250 in Lite/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / build

Nullable value type may be null.

Check warning on line 1250 in Lite/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / build

Nullable value type may be null.
numericThresholdValue: App.AlertLongRunningJobMultiplier * 100);
}
}
else if (_activeLongRunningJobAlert.TryGetValue(key, out var wasJob) && wasJob)
Expand Down
12 changes: 8 additions & 4 deletions Lite/Services/EmailAlertService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ public async Task TrySendAlertEmailAsync(
string currentValue,
string thresholdValue,
int serverId = 0,
AlertContext? context = null)
AlertContext? context = null,
double? numericCurrentValue = null,
double? numericThresholdValue = null)
{
try
{
Expand Down Expand Up @@ -108,10 +110,12 @@ public async Task TrySendAlertEmailAsync(
}

/* Always log the alert to DuckDB, regardless of email status */
var logCurrent = numericCurrentValue
?? (double.TryParse(currentValue.TrimEnd('%'), out var cv) ? cv : 0);
var logThreshold = numericThresholdValue
?? (double.TryParse(thresholdValue.TrimEnd('%'), out var tv) ? tv : 0);
await LogAlertAsync(serverId, serverName, metricName,
double.TryParse(currentValue.TrimEnd('%'), out var cv) ? cv : 0,
double.TryParse(thresholdValue.TrimEnd('%'), out var tv) ? tv : 0,
sent, notificationType, sendError);
logCurrent, logThreshold, sent, notificationType, sendError);
}
catch (Exception ex)
{
Expand Down
1 change: 1 addition & 0 deletions Lite/Services/LocalDataService.WaitStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ FROM v_wait_stats
WHERE server_id = $1
AND wait_type IN ('THREADPOOL', 'RESOURCE_SEMAPHORE', 'RESOURCE_SEMAPHORE_QUERY_COMPILE')
AND delta_waiting_tasks > 0
AND collection_time >= NOW() - INTERVAL '10 minutes'
ORDER BY collection_time DESC
LIMIT 3";

Expand Down
Loading