This commit is contained in:
2022-02-17 20:51:27 +00:00
parent fbdf7fca52
commit 96202bd812
6 changed files with 61 additions and 13 deletions

View File

@@ -20,8 +20,8 @@ namespace AyaNova.Biz
private static Process _process = Process.GetCurrentProcess();
private static TimeSpan _oldCPUTime = TimeSpan.Zero;
private static DateTime _lastMMSnapshot = DateTime.UtcNow;
private static DateTime _lastDDSnapshot = DateTime.UtcNow;
private static DateTime _lastMMSnapshot = DateTime.UtcNow.Subtract(new TimeSpan(1, 1, 1, 1, 1));//ensure it captures on a fresh boot;
private static DateTime _lastDDSnapshot = DateTime.UtcNow.Subtract(new TimeSpan(1, 1, 1, 1, 1));//ensure it captures on a fresh boot
private static double _cpu = 0;
@@ -29,7 +29,7 @@ namespace AyaNova.Biz
private static TimeSpan tsOneMinute = new TimeSpan(0, 1, 0);
private static TimeSpan ts24Hours = new TimeSpan(24, 0, 0);
#else
private static TimeSpan tsOneMinute = new TimeSpan(0, 1, 0);
private static TimeSpan tsOneMinute = new TimeSpan(24, 0, 0);
private static TimeSpan ts24Hours = new TimeSpan(24, 0, 0);
#endif
////////////////////////////////////////////////////////////////////////////////////////////////
@@ -88,6 +88,9 @@ namespace AyaNova.Biz
//System.Diagnostics.Debug.WriteLine("MM SAVED");
}
_lastMMSnapshot = now;
#if(DEBUG)
// log.LogInformation($"DEBUG DD ISSUE: during MM metrics snapshot, _lastDDSnapshot was {_lastDDSnapshot.ToString()}, IsAfterduration return value is {DateUtil.IsAfterDuration(_lastDDSnapshot, ts24Hours)} ");
#endif
}
@@ -97,7 +100,12 @@ namespace AyaNova.Biz
//
if (DateUtil.IsAfterDuration(_lastDDSnapshot, ts24Hours))
{
#if (DEBUG)
log.LogInformation("DEBUG DD metrics snapshot");
#else
log.LogDebug("DD metrics snapshot");
#endif
var now = DateTime.UtcNow;
//FILES ON DISK
var UtilFilesInfo = FileUtil.GetBackupFolderSizeInfo();