This commit is contained in:
@@ -5,6 +5,7 @@ using System.Diagnostics;
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -16,6 +17,7 @@ namespace AyaNova.Biz
|
|||||||
internal static class CoreJobMetricsSnapshot
|
internal static class CoreJobMetricsSnapshot
|
||||||
{
|
{
|
||||||
private static ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger("CoreJobMetricsSnapshot");
|
private static ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger("CoreJobMetricsSnapshot");
|
||||||
|
private static TimeSpan tsDataRetention = new TimeSpan(396, 0, 0, 0, 0);//one year and one month approximately
|
||||||
private static Process _process = Process.GetCurrentProcess();
|
private static Process _process = Process.GetCurrentProcess();
|
||||||
|
|
||||||
private static TimeSpan _oldCPUTime = TimeSpan.Zero;
|
private static TimeSpan _oldCPUTime = TimeSpan.Zero;
|
||||||
@@ -243,7 +245,7 @@ from generate_series(1, 525600) s(i)
|
|||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
//ONCE A DAY SNAPS
|
//ONCE A DAY SNAPS AND CLEANUP
|
||||||
//
|
//
|
||||||
if (DateUtil.IsAfterDuration(_lastSnapshot, ts24Hours))
|
if (DateUtil.IsAfterDuration(_lastSnapshot, ts24Hours))
|
||||||
{
|
{
|
||||||
@@ -260,7 +262,12 @@ from generate_series(1, 525600) s(i)
|
|||||||
// metrics.Measure.Gauge.SetValue(MetricsRegistry.FileCountGauge, mtag, UtilFilesInfo.FileCountWithChildren);
|
// metrics.Measure.Gauge.SetValue(MetricsRegistry.FileCountGauge, mtag, UtilFilesInfo.FileCountWithChildren);
|
||||||
// metrics.Measure.Gauge.SetValue(MetricsRegistry.FileSizeGauge, mtag, UtilFilesInfo.SizeWithChildren);
|
// metrics.Measure.Gauge.SetValue(MetricsRegistry.FileSizeGauge, mtag, UtilFilesInfo.SizeWithChildren);
|
||||||
|
|
||||||
|
/////////////////////////////////
|
||||||
|
//CLEAR OLD ENTRIES
|
||||||
|
//
|
||||||
|
|
||||||
|
DateTime ClearAfter = DateTime.UtcNow - tsDataRetention;
|
||||||
|
await ct.Database.ExecuteSqlInterpolatedAsync($"delete from ametricmm where t > {ClearAfter}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user