This commit is contained in:
2020-05-28 23:21:20 +00:00
parent 5b908de7ee
commit 0a434b732f
5 changed files with 26 additions and 21 deletions

View File

@@ -24,20 +24,21 @@ namespace AyaNova.Biz
private static double _cpu = 0;
#if(DEBUG)
private static TimeSpan tsOneMinute = new TimeSpan(0, 1, 0);
private static TimeSpan tsOneMinute = new TimeSpan(0, 0, 10);
private static TimeSpan tsOneHour = new TimeSpan(0, 1, 0);
private static TimeSpan ts24Hours = new TimeSpan(0, 1, 0);
#else
private static TimeSpan tsOneMinute = new TimeSpan(0, 1, 0);
#endif
private static TimeSpan tsOneHour = new TimeSpan(1, 0, 0);
private static TimeSpan ts24Hours = new TimeSpan(24, 0, 0);
#endif
////////////////////////////////////////////////////////////////////////////////////////////////
// DoAsync
//
public static void DoJob()
{
//Nothing is gathered less than one minute frequency
if (!DateUtil.IsAfterDuration(_lastSnapshot, tsOneMinute))
return;
@@ -143,17 +144,18 @@ namespace AyaNova.Biz
if (DateUtil.IsAfterDuration(_lastSnapshot, ts24Hours))
{
//FILES ON DISK
// log.LogTrace("Files on disk information");
// var UtilFilesInfo = FileUtil.GetUtilityFolderSizeInfo();
// var UserFilesInfo = FileUtil.GetAttachmentFolderSizeInfo();
var UtilFilesInfo = FileUtil.GetUtilityFolderSizeInfo();
var AttachmentFilesInfo = FileUtil.GetAttachmentFolderSizeInfo();
using (AyContext ct = ServiceProviderProvider.DBContext)
{
//write to db
MetricDD dd = new MetricDD(AttachmentFilesInfo.SizeWithChildren, AttachmentFilesInfo.FileCountWithChildren, UtilFilesInfo.SizeWithChildren, UtilFilesInfo.FileCountWithChildren);
ct.MetricDD.Add(dd);
ct.SaveChanges();
}
// var mtag = new MetricTags("File type", "Business object files");
// metrics.Measure.Gauge.SetValue(MetricsRegistry.FileCountGauge, mtag, UserFilesInfo.FileCountWithChildren);
// metrics.Measure.Gauge.SetValue(MetricsRegistry.FileSizeGauge, mtag, UserFilesInfo.SizeWithChildren);
// mtag = new MetricTags("File type", "OPS files");
// metrics.Measure.Gauge.SetValue(MetricsRegistry.FileCountGauge, mtag, UtilFilesInfo.FileCountWithChildren);
// metrics.Measure.Gauge.SetValue(MetricsRegistry.FileSizeGauge, mtag, UtilFilesInfo.SizeWithChildren);
/////////////////////////////////
//CLEAR OLD ENTRIES
@@ -170,7 +172,6 @@ namespace AyaNova.Biz
_lastSnapshot = now;
}
@@ -180,7 +181,5 @@ namespace AyaNova.Biz
/////////////////////////////////////////////////////////////////////
}//eoc
}//eons

View File

@@ -6,6 +6,8 @@ namespace AyaNova.Models
public partial class AyContext : DbContext
{
public virtual DbSet<MetricMM> MetricMM { get; set; }
public virtual DbSet<MetricHH> MetricHH { get; set; }
public virtual DbSet<MetricDD> MetricDD { get; set; }
public virtual DbSet<User> User { get; set; }
public virtual DbSet<UserOptions> UserOptions { get; set; }
public virtual DbSet<Widget> Widget { get; set; }

View File

@@ -20,7 +20,7 @@ namespace AyaNova.Models
public int Gen2 { get; set; }
public double CPU { get; set; }
//ef core requires this for some reason
//ef core requires this
public MetricMM() { }
public MetricMM(long allocated, long workingSet, long privateBytes, int gen0, int gen1, int gen2, double cpu)

View File

@@ -249,6 +249,10 @@ namespace AyaNova.Util
//METRICS TABLES
//One minute metrics
await ExecQueryAsync("CREATE TABLE ametricmm (t timestamp not null, allocated bigint,workingset bigint,privatebytes bigint,gen0 integer,gen1 integer,gen2 integer,cpu double precision)");
//One hour metrics
await ExecQueryAsync("CREATE TABLE ametrichh (t timestamp not null, allocated bigint,)");
//One day metrics
await ExecQueryAsync("CREATE TABLE ametricdd (t timestamp not null, allocated bigint,workingset bigint,privatebytes bigint,gen0 integer,gen1 integer,gen2 integer,cpu double precision)");
//SEARCH TABLES

View File

@@ -653,10 +653,10 @@ namespace AyaNova.Util
public DirectoryInfo Path { get; set; }
public long SizeWithChildren { get; set; }
public long Size { get; set; }
public int DirectoryCount { get; set; }
public int DirectoryCountWithChildren { get; set; }
public int FileCount { get; set; }
public int FileCountWithChildren { get; set; }
public long DirectoryCount { get; set; }
public long DirectoryCountWithChildren { get; set; }
public long FileCount { get; set; }
public long FileCountWithChildren { get; set; }
public List<FolderSizeInfo> Children { get; set; }
}