This commit is contained in:
@@ -44,7 +44,7 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get event log for object and date range specified
|
||||
/// Get event log for object and range specified
|
||||
///
|
||||
/// Required Role: Read full object properties rights to object type specified
|
||||
///
|
||||
@@ -71,7 +71,7 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get event log entries for a specified user and date range
|
||||
/// Get event log entries for a specified user and range
|
||||
///
|
||||
/// Required Role: Read rights to User object or User's own data
|
||||
///
|
||||
|
||||
@@ -68,9 +68,6 @@ namespace AyaNova.Api.Controllers
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//use specified values or just return all
|
||||
maxRecords ??= MAX_RECORDS_BEFORE_DOWNSAMPLING;
|
||||
|
||||
@@ -78,17 +75,14 @@ namespace AyaNova.Api.Controllers
|
||||
//touniversal is because the parameters are converted to local time here, but then sent to the query as local time as well and not universal time which is what it should be
|
||||
MinuteMetrics = await ct.MetricMM.AsNoTracking().Where(z => z.t >= tsStart.ToUniversalTime() && z.t <= tsEnd.ToUniversalTime()).OrderBy(z => z.t).ToListAsync();
|
||||
|
||||
//var v=await ct.MetricMM.AsNoTracking().Where(z => z.t >= tsStart.ToUniversalTime() && z.t <= tsEnd.ToUniversalTime()).OrderByDescending(z => z.t).ToListAsync();
|
||||
//Log
|
||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.Metrics, AyaEvent.Retrieved), ct);
|
||||
|
||||
|
||||
|
||||
//Downsample? This should work for longer time period metrics because the minute ones are the greatest quantity
|
||||
//Downsample
|
||||
if (maxRecords < MinuteMetrics.Count)
|
||||
{
|
||||
//yes, so need to return individual labels and downsampled data as they wont' sync anymore
|
||||
|
||||
{
|
||||
var dsCPU = MinuteMetrics.Select(z => new Tuple<double, double>(z.t.ToOADate(), z.CPU)).ToList();
|
||||
dsCPU = Util.DataUtil.LargestTriangleThreeBuckets(dsCPU, (int)maxRecords) as List<Tuple<double, double>>;
|
||||
|
||||
@@ -122,18 +116,12 @@ namespace AyaNova.Api.Controllers
|
||||
cpuLabels = dsCPU.Select(z => DateTime.FromOADate(z.Item1)).ToArray(),
|
||||
cpu = dsCPU.Select(z => z.Item2).ToArray(),
|
||||
genAllLabels = dsGen0.Select(z => DateTime.FromOADate(z.Item1)).Union(dsGen1.Select(z => DateTime.FromOADate(z.Item1))).Union(dsGen2.Select(z => DateTime.FromOADate(z.Item1))).ToArray(),
|
||||
// gen0Labels = dsGen0.Select(z => DateTime.FromOADate(z.Item1)).ToArray(),
|
||||
gen0 = dsGen0.Select(z => (int)z.Item2).ToArray(),
|
||||
// gen1Labels = dsGen1.Select(z => DateTime.FromOADate(z.Item1)).ToArray(),
|
||||
gen1 = dsGen1.Select(z => (int)z.Item2).ToArray(),
|
||||
// gen2Labels = dsGen2.Select(z => DateTime.FromOADate(z.Item1)).ToArray(),
|
||||
gen2 = dsGen2.Select(z => (int)z.Item2).ToArray(),
|
||||
memAllLabels = dsAllocated.Select(z => DateTime.FromOADate(z.Item1)).Union(dsWorkingSet.Select(z => DateTime.FromOADate(z.Item1))).Union(dsPrivateBytes.Select(z => DateTime.FromOADate(z.Item1))).ToArray(),
|
||||
// allocatedLabels = dsAllocated.Select(z => DateTime.FromOADate(z.Item1)).ToArray(),
|
||||
allocated = dsAllocated.Select(z => z.Item2 / MB).ToArray(),
|
||||
//workingSetLabels = dsWorkingSet.Select(z => DateTime.FromOADate(z.Item1)).ToArray(),
|
||||
workingSet = dsWorkingSet.Select(z => z.Item2 / MB).ToArray(),
|
||||
// privateBytesLabels = dsPrivateBytes.Select(z => DateTime.FromOADate(z.Item1)).ToArray(),
|
||||
privateBytes = dsPrivateBytes.Select(z => z.Item2 / MB).ToArray()
|
||||
|
||||
}
|
||||
@@ -149,9 +137,8 @@ namespace AyaNova.Api.Controllers
|
||||
{
|
||||
DownSampled = false,
|
||||
MetricMM = new
|
||||
{
|
||||
//labels = MinuteMetrics.Select(z => z.t.ToUniversalTime()).ToArray(),//db is in UTC, ef core retrieves as if it was local
|
||||
labels = MinuteMetrics.Select(z => z.t).ToArray(),//db is in UTC, ef core retrieves as if it was local
|
||||
{
|
||||
labels = MinuteMetrics.Select(z => z.t).ToArray(),
|
||||
cpu = MinuteMetrics.Select(z => z.CPU).ToArray(),
|
||||
gen0 = MinuteMetrics.Select(z => z.Gen0).ToArray(),
|
||||
gen1 = MinuteMetrics.Select(z => z.Gen1).ToArray(),
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
// namespace AyaNova.DataList
|
||||
// {
|
||||
// public static class DataListFilterSpecialToken
|
||||
// {
|
||||
// public const string Null = "*NULL*";
|
||||
// public const string Yesterday = "{[yesterday]}";
|
||||
// public const string Today = "{[today]}";
|
||||
// public const string Tomorrow = "{[tomorrow]}";
|
||||
// public const string LastWeek = "{[lastweek]}";
|
||||
// public const string ThisWeek = "{[thisweek]}";
|
||||
// public const string NextWeek = "{[nextweek]}";
|
||||
// public const string LastMonth = "{[lastmonth]}";
|
||||
// public const string ThisMonth = "{[thismonth]}";
|
||||
// public const string NextMonth = "{[nextmonth]}";
|
||||
// public const string FourteenDayWindow = "{[14daywindow]}";
|
||||
// public const string Past = "{[past]}";
|
||||
// public const string Future = "{[future]}";
|
||||
// public const string LastYear = "{[lastyear]}";
|
||||
// public const string ThisYear = "{[thisyear]}";
|
||||
// public const string InTheLast3Months = "{[last3months]}";
|
||||
// public const string InTheLast6Months = "{[last6months]}";
|
||||
// public const string InTheLastYear = "{[lastcalendaryear]}";
|
||||
|
||||
// //Months THIS year
|
||||
// public const string January = "{[january]}";
|
||||
// public const string February = "{[february]}";
|
||||
// public const string March = "{[march]}";
|
||||
// public const string April = "{[april]}";
|
||||
// public const string May = "{[may]}";
|
||||
// public const string June = "{[june]}";
|
||||
// public const string July = "{[july]}";
|
||||
// public const string August = "{[august]}";
|
||||
// public const string September = "{[september]}";
|
||||
// public const string October = "{[october]}";
|
||||
// public const string November = "{[november]}";
|
||||
// public const string December = "{[december]}";
|
||||
|
||||
// //These TEXT filter tokens were more for paging purposes than anything else
|
||||
// //however paging is done by numeric range now so will not implement for now
|
||||
// // public const string AH = "{[ah]}";
|
||||
// // public const string IP = "{[ip]}";
|
||||
// // public const string QZ = "{[qz]}";
|
||||
// // public const string ZeroToThree = "{[03]}";
|
||||
// // public const string FourToSix = "{[46]}";
|
||||
// // public const string SevenToNine = "{[79]}";
|
||||
|
||||
|
||||
// //Don't think I need these
|
||||
// //public const string LessThanZero = "{[<0]}";
|
||||
// // public const string Zero = "{[0]}";
|
||||
// //public const string GreaterThanZero = "{[>0]}";
|
||||
|
||||
// //https://www.klipfolio.com/resources/articles/kpi-timeframe-comparison-metrics
|
||||
|
||||
// //More business time frames
|
||||
|
||||
// public const string YearToDate = "{[yeartodate]}";
|
||||
|
||||
// public const string Past90Days = "{[past90days]}";
|
||||
// public const string Past30Days = "{[past30days]}";
|
||||
// public const string Past24Hours = "{[past24hours]}";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// }
|
||||
// }
|
||||
@@ -37,27 +37,7 @@ namespace AyaNova.Biz
|
||||
public static void DoJob()
|
||||
{
|
||||
|
||||
/*
|
||||
TODO:
|
||||
Add routes with downsampling / decimation option
|
||||
i.e. Fetch(timeperiod, results to fetch) if(resultstofetch < result of query for timeperiod downsample to make it fit)
|
||||
OK, not a trivial thing to graph it requires "downsampling" or "decimation"
|
||||
Here is a link to a c# method that will accomplish this:
|
||||
https://github.com/sveinn-steinarsson/flot-downsample/
|
||||
c#
|
||||
https://gist.github.com/DanielWJudge/63300889f27c7f50eeb7
|
||||
|
||||
Add the other key metrics (datadog)
|
||||
|
||||
UI bit
|
||||
|
||||
Finally
|
||||
make sure all the constants are set back to their proper production / testing values
|
||||
Clean out old metrics DOCS and make a note for this stuff
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
//Nothing is gathered less than one minute frequency
|
||||
if (!DateUtil.IsAfterDuration(_lastSnapshot, tsOneMinute))
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user