This commit is contained in:
@@ -24,20 +24,21 @@ namespace AyaNova.Biz
|
|||||||
private static double _cpu = 0;
|
private static double _cpu = 0;
|
||||||
|
|
||||||
#if(DEBUG)
|
#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
|
#else
|
||||||
private static TimeSpan tsOneMinute = new TimeSpan(0, 1, 0);
|
private static TimeSpan tsOneMinute = new TimeSpan(0, 1, 0);
|
||||||
#endif
|
|
||||||
private static TimeSpan tsOneHour = new TimeSpan(1, 0, 0);
|
private static TimeSpan tsOneHour = new TimeSpan(1, 0, 0);
|
||||||
private static TimeSpan ts24Hours = new TimeSpan(24, 0, 0);
|
private static TimeSpan ts24Hours = new TimeSpan(24, 0, 0);
|
||||||
|
#endif
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// DoAsync
|
// DoAsync
|
||||||
//
|
//
|
||||||
public static void DoJob()
|
public static void DoJob()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
//Nothing is gathered less than one minute frequency
|
//Nothing is gathered less than one minute frequency
|
||||||
if (!DateUtil.IsAfterDuration(_lastSnapshot, tsOneMinute))
|
if (!DateUtil.IsAfterDuration(_lastSnapshot, tsOneMinute))
|
||||||
return;
|
return;
|
||||||
@@ -143,17 +144,18 @@ namespace AyaNova.Biz
|
|||||||
if (DateUtil.IsAfterDuration(_lastSnapshot, ts24Hours))
|
if (DateUtil.IsAfterDuration(_lastSnapshot, ts24Hours))
|
||||||
{
|
{
|
||||||
//FILES ON DISK
|
//FILES ON DISK
|
||||||
// log.LogTrace("Files on disk information");
|
var UtilFilesInfo = FileUtil.GetUtilityFolderSizeInfo();
|
||||||
// var UtilFilesInfo = FileUtil.GetUtilityFolderSizeInfo();
|
var AttachmentFilesInfo = FileUtil.GetAttachmentFolderSizeInfo();
|
||||||
// var UserFilesInfo = 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
|
//CLEAR OLD ENTRIES
|
||||||
@@ -170,7 +172,6 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
|
|
||||||
_lastSnapshot = now;
|
_lastSnapshot = now;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -180,7 +181,5 @@ namespace AyaNova.Biz
|
|||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
}//eoc
|
}//eoc
|
||||||
|
|
||||||
|
|
||||||
}//eons
|
}//eons
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ namespace AyaNova.Models
|
|||||||
public partial class AyContext : DbContext
|
public partial class AyContext : DbContext
|
||||||
{
|
{
|
||||||
public virtual DbSet<MetricMM> MetricMM { get; set; }
|
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<User> User { get; set; }
|
||||||
public virtual DbSet<UserOptions> UserOptions { get; set; }
|
public virtual DbSet<UserOptions> UserOptions { get; set; }
|
||||||
public virtual DbSet<Widget> Widget { get; set; }
|
public virtual DbSet<Widget> Widget { get; set; }
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace AyaNova.Models
|
|||||||
public int Gen2 { get; set; }
|
public int Gen2 { get; set; }
|
||||||
public double CPU { get; set; }
|
public double CPU { get; set; }
|
||||||
|
|
||||||
//ef core requires this for some reason
|
//ef core requires this
|
||||||
public MetricMM() { }
|
public MetricMM() { }
|
||||||
|
|
||||||
public MetricMM(long allocated, long workingSet, long privateBytes, int gen0, int gen1, int gen2, double cpu)
|
public MetricMM(long allocated, long workingSet, long privateBytes, int gen0, int gen1, int gen2, double cpu)
|
||||||
|
|||||||
@@ -249,6 +249,10 @@ namespace AyaNova.Util
|
|||||||
//METRICS TABLES
|
//METRICS TABLES
|
||||||
//One minute metrics
|
//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)");
|
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
|
//SEARCH TABLES
|
||||||
|
|||||||
@@ -653,10 +653,10 @@ namespace AyaNova.Util
|
|||||||
public DirectoryInfo Path { get; set; }
|
public DirectoryInfo Path { get; set; }
|
||||||
public long SizeWithChildren { get; set; }
|
public long SizeWithChildren { get; set; }
|
||||||
public long Size { get; set; }
|
public long Size { get; set; }
|
||||||
public int DirectoryCount { get; set; }
|
public long DirectoryCount { get; set; }
|
||||||
public int DirectoryCountWithChildren { get; set; }
|
public long DirectoryCountWithChildren { get; set; }
|
||||||
public int FileCount { get; set; }
|
public long FileCount { get; set; }
|
||||||
public int FileCountWithChildren { get; set; }
|
public long FileCountWithChildren { get; set; }
|
||||||
public List<FolderSizeInfo> Children { get; set; }
|
public List<FolderSizeInfo> Children { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user