diff --git a/MP.Data/Services/Utils/IStatsAggrService.cs b/MP.Data/Services/Utils/IStatsAggrService.cs index 9208557e..77e2c4e1 100644 --- a/MP.Data/Services/Utils/IStatsAggrService.cs +++ b/MP.Data/Services/Utils/IStatsAggrService.cs @@ -26,6 +26,13 @@ namespace MP.Data.Services.Utils /// Task>> GetParetoStatsWeekAsync(); + /// + /// Restituisce un dizionario di elaborazioni di tipo Pareto su orizzonte giornaliero + /// Ogni elaborazione contiene Dictionary in forma pareto per una data statistica + /// + /// + Task>> GetParetoStatsDayAsync(int numDay); + /// /// Recupera il range di periodi valido per le chiamate aggregate. /// Utilizza la cache automaticamente. diff --git a/MP.Data/Services/Utils/StatsAggrService.cs b/MP.Data/Services/Utils/StatsAggrService.cs index c9646966..088b40fd 100644 --- a/MP.Data/Services/Utils/StatsAggrService.cs +++ b/MP.Data/Services/Utils/StatsAggrService.cs @@ -44,7 +44,7 @@ namespace MP.Data.Services.Utils /// public async Task>> GetParetoStatsWeekAsync() { - return await TraceAsync($"{_className}.GetDailyParetoStats", async (activity) => + return await TraceAsync($"{_className}.GetParetoStatsWeekAsync", async (activity) => { return await GetOrSetCacheAsync( $"{_redisBaseKey}:{_className}:ParetoWeek", @@ -53,6 +53,18 @@ namespace MP.Data.Services.Utils ); }); } + /// + public async Task>> GetParetoStatsDayAsync(int numDay) + { + return await TraceAsync($"{_className}.GetParetoStatsDayAsync", async (activity) => + { + return await GetOrSetCacheAsync( + $"{_redisBaseKey}:{_className}:ParetoDay", + async () => await GetParetoMaccAsync(numDay), + LongCache + ); + }); + } /// public async Task GetRangeAsync() @@ -123,6 +135,35 @@ namespace MP.Data.Services.Utils return result; } + protected async Task>> GetParetoMaccAsync(int numDay) + { + Dictionary> result = new(); + DateTime oggi = DateTime.Today; + var rawData = await GetFiltAsync(oggi.AddDays(-numDay), oggi); + // calcolo le varie statistiche... + var pDestRequest = rawData.GroupBy(x => x.MachineId) + .Select(g => new StatDataDTO + { + Label = g.Key, + Value = g.Sum(x => x.RequestCount) + }) + .OrderByDescending(x => x.Value) + .ToList(); + result.Add("Mach.Request (#)", pDestRequest); + + var pDestDuration = rawData.GroupBy(x => x.MachineId) + .Select(g => new StatDataDTO + { + Label = g.Key, + Value = g.Sum(x => x.RequestCount * x.AvgDuration) + }) + .OrderByDescending(x => x.Value) + .ToList(); + result.Add("Mach.Duration (ms)", pDestDuration); + + return result; + } + #endregion Protected Methods #region Private Fields diff --git a/MP.Data/Services/Utils/StatsDetailService.cs b/MP.Data/Services/Utils/StatsDetailService.cs index b47cfd94..eda36d9e 100644 --- a/MP.Data/Services/Utils/StatsDetailService.cs +++ b/MP.Data/Services/Utils/StatsDetailService.cs @@ -196,25 +196,25 @@ namespace MP.Data.Services.Utils .ToList(); result.Add("Type.Duration (ms)", pTypeDuration); - // calcolo le varie statistiche COMPOSTE... - var pDestTypeRequest = rawData.GroupBy(x => new { x.Destination, x.Type }) - .Select(g => new StatDataDTO - { - Label = $"{g.Key.Destination}.{g.Key.Type}", - Value = g.Sum(x => x.RequestCount) - }) - .OrderByDescending(x => x.Value) - .ToList(); - result.Add("DestType.Request (#)", pDestTypeRequest); - var pDestTypeDuration = rawData.GroupBy(x => new { x.Destination, x.Type }) - .Select(g => new StatDataDTO - { - Label = $"{g.Key.Destination}.{g.Key.Type}", - Value = g.Sum(x => x.RequestCount * x.AvgDuration) - }) - .OrderByDescending(x => x.Value) - .ToList(); - result.Add("DestType.Duration (ms)", pDestTypeDuration); + //// calcolo le varie statistiche COMPOSTE... + //var pDestTypeRequest = rawData.GroupBy(x => new { x.Destination, x.Type }) + // .Select(g => new StatDataDTO + // { + // Label = $"{g.Key.Destination}.{g.Key.Type}", + // Value = g.Sum(x => x.RequestCount) + // }) + // .OrderByDescending(x => x.Value) + // .ToList(); + //result.Add("DestType.Request (#)", pDestTypeRequest); + //var pDestTypeDuration = rawData.GroupBy(x => new { x.Destination, x.Type }) + // .Select(g => new StatDataDTO + // { + // Label = $"{g.Key.Destination}.{g.Key.Type}", + // Value = g.Sum(x => x.RequestCount * x.AvgDuration) + // }) + // .OrderByDescending(x => x.Value) + // .ToList(); + //result.Add("DestType.Duration (ms)", pDestTypeDuration); return result; } diff --git a/MP.IOC/Components/Pages/CallStats.razor.cs b/MP.IOC/Components/Pages/CallStats.razor.cs index 8aee3984..f8b63e49 100644 --- a/MP.IOC/Components/Pages/CallStats.razor.cs +++ b/MP.IOC/Components/Pages/CallStats.razor.cs @@ -98,6 +98,9 @@ namespace MP.IOC.Components.Pages [Inject] private IStatsDetailService SDetService { get; set; } = null!; + [Inject] + private IStatsAggrService SAggService { get; set; } = null!; + #endregion Private Properties #region Private Methods @@ -211,6 +214,12 @@ namespace MP.IOC.Components.Pages private async Task ReloadData() { ParetoDay = await SDetService.GetParetoStatsDayAsync(); + //calcolo le statistiche aggregate e le aggiungo + var machDay = await SAggService.GetParetoStatsDayAsync(0); + foreach (var item in machDay) + { + ParetoDay.TryAdd(item.Key, item.Value.Where(x => x.Label != "ALL").ToList()); + } } /// diff --git a/MP.IOC/Components/Pages/Index.razor b/MP.IOC/Components/Pages/Index.razor index 7e9abb08..21ab15f0 100644 --- a/MP.IOC/Components/Pages/Index.razor +++ b/MP.IOC/Components/Pages/Index.razor @@ -137,16 +137,16 @@
  • - Call Processed + Daily Call Processed
  • @foreach (var item in ListGlobalCall) {
  • - @($"{item.Hour:yyyy-MM-dd}") | @item.Destination + @item.Label
    - @($"{item.RequestCount:N0}") + @($"{item.Value:N0}")
  • } diff --git a/MP.IOC/Components/Pages/Index.razor.cs b/MP.IOC/Components/Pages/Index.razor.cs index e02e4513..1424145f 100644 --- a/MP.IOC/Components/Pages/Index.razor.cs +++ b/MP.IOC/Components/Pages/Index.razor.cs @@ -18,7 +18,7 @@ namespace MP.IOC.Components.Pages #region Private Fields - private List ListGlobalCall = new(); + private List ListGlobalCall = new(); private List ListParetoCall = new(); @@ -42,8 +42,8 @@ namespace MP.IOC.Components.Pages { DateTime oggi = DateTime.Today; DateTime adesso = DateTime.Now; - var rawData = await StatsAggrService.GetFiltAsync(oggi.AddDays(-5), oggi); - ListGlobalCall = rawData.OrderByDescending(x => x.Hour).ToList(); + var paretoDayCall = await StatsAggrService.GetParetoStatsDayAsync(0); + ListGlobalCall = paretoDayCall["Mach.Duration (ms)"]; ListParetoCall = await StatsDetService.GetParetoAsync(adesso.AddHours(-1), adesso, 10); paretoWeek = await StatsAggrService.GetParetoStatsWeekAsync(); } diff --git a/MP.IOC/MP.IOC.csproj b/MP.IOC/MP.IOC.csproj index c4a30446..560fffd0 100644 --- a/MP.IOC/MP.IOC.csproj +++ b/MP.IOC/MP.IOC.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 6.16.2604.2218 + 6.16.2604.2219 diff --git a/MP.IOC/Resources/ChangeLog.html b/MP.IOC/Resources/ChangeLog.html index 09bec829..bc29cdd2 100644 --- a/MP.IOC/Resources/ChangeLog.html +++ b/MP.IOC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MP-IOC -

    Versione: 6.16.2604.2218

    +

    Versione: 6.16.2604.2219


    Note di rilascio:
    • diff --git a/MP.IOC/Resources/VersNum.txt b/MP.IOC/Resources/VersNum.txt index 2624fad6..24856547 100644 --- a/MP.IOC/Resources/VersNum.txt +++ b/MP.IOC/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2604.2218 +6.16.2604.2219 diff --git a/MP.IOC/Resources/manifest.xml b/MP.IOC/Resources/manifest.xml index 9951641d..b4b60577 100644 --- a/MP.IOC/Resources/manifest.xml +++ b/MP.IOC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2604.2218 + 6.16.2604.2219 https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/MP.IOC.zip https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/ChangeLog.html false