diff --git a/MP.Data/DbModels/Utils/StatsAggregatedModel.cs b/MP.Data/DbModels/Utils/StatsAggregatedModel.cs index 59501f32..d7a3e721 100644 --- a/MP.Data/DbModels/Utils/StatsAggregatedModel.cs +++ b/MP.Data/DbModels/Utils/StatsAggregatedModel.cs @@ -18,11 +18,7 @@ namespace MP.Data.DbModels.Utils /// /// Ambiente IOC/IO (new/old) /// - public string Environment { get; set; } = ""; - /// - /// Codice tipo (metodo chiamato) - /// - public string Type { get; set; } = ""; + public string Envir { get; set; } = ""; /// /// DataOra riferimento /// @@ -44,7 +40,7 @@ namespace MP.Data.DbModels.Utils /// public double MaxDuration { get; set; } = 0; /// - /// numero richieste senza risposta (num RUID avviati - num RUID chiusi) + /// numero richieste senza risposta (errori) /// public long NoReply { get; set; } = 0; } diff --git a/MP.Data/DbModels/Utils/StatsDetailModel.cs b/MP.Data/DbModels/Utils/StatsDetailModel.cs index 0b3744b4..351b45f4 100644 --- a/MP.Data/DbModels/Utils/StatsDetailModel.cs +++ b/MP.Data/DbModels/Utils/StatsDetailModel.cs @@ -18,7 +18,7 @@ namespace MP.Data.DbModels.Utils /// /// Ambiente IOC/IO (new/old) /// - public string Environment { get; set; } = ""; + public string Envir { get; set; } = ""; /// /// Codice tipo (metodo chiamato) /// @@ -44,7 +44,7 @@ namespace MP.Data.DbModels.Utils /// public double MaxDuration { get; set; } = 0; /// - /// numero richieste senza risposta (num RUID avviati - num RUID chiusi) + /// numero richieste senza risposta (errori) /// public long NoReply { get; set; } = 0; } diff --git a/MP.Data/Migrations/MoonPro_Utils/20260407093448_InitDb.Designer.cs b/MP.Data/Migrations/MoonPro_Utils/20260408050203_InitDb.Designer.cs similarity index 85% rename from MP.Data/Migrations/MoonPro_Utils/20260407093448_InitDb.Designer.cs rename to MP.Data/Migrations/MoonPro_Utils/20260408050203_InitDb.Designer.cs index ae5da7e4..b2f09de2 100644 --- a/MP.Data/Migrations/MoonPro_Utils/20260407093448_InitDb.Designer.cs +++ b/MP.Data/Migrations/MoonPro_Utils/20260408050203_InitDb.Designer.cs @@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace MP.Data.Migrations.MoonPro_Utils { [DbContext(typeof(MoonPro_UtilsContext))] - [Migration("20260407093448_InitDb")] + [Migration("20260408050203_InitDb")] partial class InitDb { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -36,8 +36,8 @@ namespace MP.Data.Migrations.MoonPro_Utils b.Property("AvgDuration") .HasColumnType("float"); - b.Property("Environment") - .HasColumnType("nvarchar(max)"); + b.Property("Envir") + .HasColumnType("nvarchar(450)"); b.Property("Hour") .HasColumnType("datetime2"); @@ -54,14 +54,12 @@ namespace MP.Data.Migrations.MoonPro_Utils b.Property("RequestCount") .HasColumnType("bigint"); - b.Property("Type") - .HasColumnType("nvarchar(max)"); - b.HasKey("Id"); - b.HasIndex("Hour") + b.HasIndex("Envir", "Hour") .IsUnique() - .HasDatabaseName("idx_statsaggr_hour"); + .HasDatabaseName("idx_statsaggr_env_hour") + .HasFilter("[Envir] IS NOT NULL"); b.ToTable("stats_aggr"); }); @@ -77,7 +75,7 @@ namespace MP.Data.Migrations.MoonPro_Utils b.Property("AvgDuration") .HasColumnType("float"); - b.Property("Environment") + b.Property("Envir") .HasColumnType("nvarchar(450)"); b.Property("Hour") @@ -100,10 +98,10 @@ namespace MP.Data.Migrations.MoonPro_Utils b.HasKey("Id"); - b.HasIndex("Hour", "Environment", "Type") + b.HasIndex("Envir", "Type", "Hour") .IsUnique() .HasDatabaseName("idx_statsdet_hour_env_type") - .HasFilter("[Environment] IS NOT NULL AND [Type] IS NOT NULL"); + .HasFilter("[Envir] IS NOT NULL AND [Type] IS NOT NULL"); b.ToTable("stats_detail"); }); diff --git a/MP.Data/Migrations/MoonPro_Utils/20260407093448_InitDb.cs b/MP.Data/Migrations/MoonPro_Utils/20260408050203_InitDb.cs similarity index 84% rename from MP.Data/Migrations/MoonPro_Utils/20260407093448_InitDb.cs rename to MP.Data/Migrations/MoonPro_Utils/20260408050203_InitDb.cs index 4f4eb6f4..2f40f4fa 100644 --- a/MP.Data/Migrations/MoonPro_Utils/20260407093448_InitDb.cs +++ b/MP.Data/Migrations/MoonPro_Utils/20260408050203_InitDb.cs @@ -15,8 +15,7 @@ namespace MP.Data.Migrations.MoonPro_Utils { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), - Environment = table.Column(type: "nvarchar(max)", nullable: true), - Type = table.Column(type: "nvarchar(max)", nullable: true), + Envir = table.Column(type: "nvarchar(450)", nullable: true), Hour = table.Column(type: "datetime2", nullable: false), RequestCount = table.Column(type: "bigint", nullable: false), AvgDuration = table.Column(type: "float", nullable: false), @@ -35,7 +34,7 @@ namespace MP.Data.Migrations.MoonPro_Utils { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), - Environment = table.Column(type: "nvarchar(450)", nullable: true), + Envir = table.Column(type: "nvarchar(450)", nullable: true), Type = table.Column(type: "nvarchar(450)", nullable: true), Hour = table.Column(type: "datetime2", nullable: false), RequestCount = table.Column(type: "bigint", nullable: false), @@ -50,17 +49,18 @@ namespace MP.Data.Migrations.MoonPro_Utils }); migrationBuilder.CreateIndex( - name: "idx_statsaggr_hour", + name: "idx_statsaggr_env_hour", table: "stats_aggr", - column: "Hour", - unique: true); + columns: new[] { "Envir", "Hour" }, + unique: true, + filter: "[Envir] IS NOT NULL"); migrationBuilder.CreateIndex( name: "idx_statsdet_hour_env_type", table: "stats_detail", - columns: new[] { "Hour", "Environment", "Type" }, + columns: new[] { "Envir", "Type", "Hour" }, unique: true, - filter: "[Environment] IS NOT NULL AND [Type] IS NOT NULL"); + filter: "[Envir] IS NOT NULL AND [Type] IS NOT NULL"); } protected override void Down(MigrationBuilder migrationBuilder) diff --git a/MP.Data/Migrations/MoonPro_Utils/MoonPro_UtilsContextModelSnapshot.cs b/MP.Data/Migrations/MoonPro_Utils/MoonPro_UtilsContextModelSnapshot.cs index 060a7264..6b2eed7c 100644 --- a/MP.Data/Migrations/MoonPro_Utils/MoonPro_UtilsContextModelSnapshot.cs +++ b/MP.Data/Migrations/MoonPro_Utils/MoonPro_UtilsContextModelSnapshot.cs @@ -34,8 +34,8 @@ namespace MP.Data.Migrations.MoonPro_Utils b.Property("AvgDuration") .HasColumnType("float"); - b.Property("Environment") - .HasColumnType("nvarchar(max)"); + b.Property("Envir") + .HasColumnType("nvarchar(450)"); b.Property("Hour") .HasColumnType("datetime2"); @@ -52,14 +52,12 @@ namespace MP.Data.Migrations.MoonPro_Utils b.Property("RequestCount") .HasColumnType("bigint"); - b.Property("Type") - .HasColumnType("nvarchar(max)"); - b.HasKey("Id"); - b.HasIndex("Hour") + b.HasIndex("Envir", "Hour") .IsUnique() - .HasDatabaseName("idx_statsaggr_hour"); + .HasDatabaseName("idx_statsaggr_env_hour") + .HasFilter("[Envir] IS NOT NULL"); b.ToTable("stats_aggr"); }); @@ -75,7 +73,7 @@ namespace MP.Data.Migrations.MoonPro_Utils b.Property("AvgDuration") .HasColumnType("float"); - b.Property("Environment") + b.Property("Envir") .HasColumnType("nvarchar(450)"); b.Property("Hour") @@ -98,10 +96,10 @@ namespace MP.Data.Migrations.MoonPro_Utils b.HasKey("Id"); - b.HasIndex("Hour", "Environment", "Type") + b.HasIndex("Envir", "Type", "Hour") .IsUnique() .HasDatabaseName("idx_statsdet_hour_env_type") - .HasFilter("[Environment] IS NOT NULL AND [Type] IS NOT NULL"); + .HasFilter("[Envir] IS NOT NULL AND [Type] IS NOT NULL"); b.ToTable("stats_detail"); }); diff --git a/MP.Data/MoonPro_UtilsContext.cs b/MP.Data/MoonPro_UtilsContext.cs index 5220a4e3..cf8eb260 100644 --- a/MP.Data/MoonPro_UtilsContext.cs +++ b/MP.Data/MoonPro_UtilsContext.cs @@ -80,12 +80,12 @@ namespace MP.Data // indici tabelle stats modelBuilder.Entity() - .HasIndex(x => new { x.Hour, x.Environment, x.Type }) + .HasIndex(x => new { x.Envir, x.Type, x.Hour }) .HasDatabaseName("idx_statsdet_hour_env_type") .IsUnique(); modelBuilder.Entity() - .HasIndex(x => new { x.Hour }) - .HasDatabaseName("idx_statsaggr_hour") + .HasIndex(x => new { x.Envir, x.Hour }) + .HasDatabaseName("idx_statsaggr_env_hour") .IsUnique(); // modelBuilder.Entity(entity => diff --git a/MP.Data/Repository/Utils/StatsAggrRepository.cs b/MP.Data/Repository/Utils/StatsAggrRepository.cs index 1d521b31..90077131 100644 --- a/MP.Data/Repository/Utils/StatsAggrRepository.cs +++ b/MP.Data/Repository/Utils/StatsAggrRepository.cs @@ -84,23 +84,23 @@ namespace MP.Data.Repository.Utils // ora preparo inserimento massivo var existingRecords = await dbCtx .DbSetStatsAggr - .Where(x => listRecords.Select(r => r.Hour).Contains(x.Hour) && - listRecords.Select(r => r.Type).Contains(x.Type)) + .Where(x => listRecords.Select(r => r.Hour).Contains(x.Hour) && + listRecords.Select(r => r.Envir).Contains(x.Envir)) .ToListAsync(); if (existingRecords.Count > 0) { - var existingHours = existingRecords.Select(r => new { r.Hour, r.Type }).ToHashSet(); - - var recordsToUpdate = listRecords.Where(r => - existingHours.Contains(new { Hour = r.Hour, Type = r.Type })).ToList(); + var existingHours = existingRecords.Select(r => new { r.Hour, r.Envir }).ToHashSet(); - var recordsToAdd = listRecords.Where(r => - !existingHours.Contains(new { Hour = r.Hour, Type = r.Type })).ToList(); + var recordsToUpdate = listRecords.Where(r => + existingHours.Contains(new { Hour = r.Hour, Envir = r.Envir })).ToList(); + + var recordsToAdd = listRecords.Where(r => + !existingHours.Contains(new { Hour = r.Hour, Envir = r.Envir })).ToList(); foreach (var updateRec in recordsToUpdate) { - var existing = existingRecords.First(x => x.Hour == updateRec.Hour && x.Type == updateRec.Type); + var existing = existingRecords.First(x => x.Hour == updateRec.Hour && x.Envir == updateRec.Envir); existing.RequestCount = updateRec.RequestCount; existing.AvgDuration = updateRec.AvgDuration; existing.MaxDuration = updateRec.MaxDuration; diff --git a/MP.Data/Repository/Utils/StatsDetailRepository.cs b/MP.Data/Repository/Utils/StatsDetailRepository.cs index f687ac45..2f0d4036 100644 --- a/MP.Data/Repository/Utils/StatsDetailRepository.cs +++ b/MP.Data/Repository/Utils/StatsDetailRepository.cs @@ -31,7 +31,7 @@ namespace MP.Data.Repository.Utils .Where(x => x.Hour >= dtStart && x.Hour <= dtEnd); if (!string.IsNullOrEmpty(sEnvir)) - query = query.Where(x => x.Environment == sEnvir); + query = query.Where(x => x.Envir == sEnvir); if (!string.IsNullOrEmpty(sType)) query = query.Where(x => x.Type == sType); @@ -39,7 +39,7 @@ namespace MP.Data.Repository.Utils answ = await query .AsNoTracking() .OrderBy(x => x.Hour) - .ThenBy(x => x.Environment) + .ThenBy(x => x.Envir) .ThenBy(x => x.Type) .ToListAsync(); @@ -55,7 +55,7 @@ namespace MP.Data.Repository.Utils var query = dbCtx.DbSetStatsDet.AsQueryable(); if (!string.IsNullOrEmpty(sEnvir)) - query = query.Where(x => x.Environment == sEnvir); + query = query.Where(x => x.Envir == sEnvir); if (!string.IsNullOrEmpty(sType)) query = query.Where(x => x.Type == sType); @@ -105,22 +105,22 @@ namespace MP.Data.Repository.Utils // ora preparo inserimento massivo var existingRecords = await dbCtx .DbSetStatsDet - .Where(x => listRecords.Select(r => new { r.Hour, r.Environment, r.Type }).Contains(new { Hour = x.Hour, Environment = x.Environment, Type = x.Type })) + .Where(x => listRecords.Select(r => new { r.Hour, r.Envir, r.Type }).Contains(new { Hour = x.Hour, Envir = x.Envir, Type = x.Type })) .ToListAsync(); if (existingRecords.Count > 0) { - var existingKeys = existingRecords.Select(r => new { r.Hour, r.Environment, r.Type }).ToHashSet(); - - var recordsToUpdate = listRecords.Where(r => - existingKeys.Contains(new { Hour = r.Hour, Environment = r.Environment, Type = r.Type })).ToList(); + var existingKeys = existingRecords.Select(r => new { r.Hour, r.Envir, r.Type }).ToHashSet(); - var recordsToAdd = listRecords.Where(r => - !existingKeys.Contains(new { Hour = r.Hour, Environment = r.Environment, Type = r.Type })).ToList(); + var recordsToUpdate = listRecords.Where(r => + existingKeys.Contains(new { Hour = r.Hour, Envir = r.Envir, Type = r.Type })).ToList(); + + var recordsToAdd = listRecords.Where(r => + !existingKeys.Contains(new { Hour = r.Hour, Envir = r.Envir, Type = r.Type })).ToList(); foreach (var updateRec in recordsToUpdate) { - var existing = existingRecords.First(x => x.Hour == updateRec.Hour && x.Environment == updateRec.Environment && x.Type == updateRec.Type); + var existing = Enumerable.First(existingRecords, (Func)(x => x.Hour == updateRec.Hour && x.Envir == updateRec.Envir && x.Type == updateRec.Type)); existing.RequestCount = updateRec.RequestCount; existing.AvgDuration = updateRec.AvgDuration; existing.MaxDuration = updateRec.MaxDuration; diff --git a/MP.IOC/Controllers/IOBController.cs b/MP.IOC/Controllers/IOBController.cs index 78bfdae2..44a2eca7 100644 --- a/MP.IOC/Controllers/IOBController.cs +++ b/MP.IOC/Controllers/IOBController.cs @@ -223,7 +223,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog(string.Format("Errore in enabled{0}{1}", Environment.NewLine, exc)); + // logger.lg.scriviLog(string.Format("Errore in enabled{0}{1}", Envir.NewLine, exc)); // answ = "NO"; // } // } @@ -264,7 +264,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog($"Errore in fase deserializzazione inputJson{Environment.NewLine}{exc}"); + // logger.lg.scriviLog($"Errore in fase deserializzazione inputJson{Envir.NewLine}{exc}"); // answ = "NO"; // } // // se ho qualcosa da processare... @@ -292,7 +292,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog($"Errore in fase invio valori inputJson{Environment.NewLine}{exc}"); + // logger.lg.scriviLog($"Errore in fase invio valori inputJson{Envir.NewLine}{exc}"); // answ = "NO"; // } // } @@ -375,7 +375,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog($"Eccezione in recupero fixDailyDossier{Environment.NewLine}{exc}", tipoLog.EXCEPTION); + // logger.lg.scriviLog($"Eccezione in recupero fixDailyDossier{Envir.NewLine}{exc}", tipoLog.EXCEPTION); // } // return answ; //} @@ -415,7 +415,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog($"Eccezione in recupero fixDailyOdl{Environment.NewLine}{exc}", tipoLog.EXCEPTION); + // logger.lg.scriviLog($"Eccezione in recupero fixDailyOdl{Envir.NewLine}{exc}", tipoLog.EXCEPTION); // } // return answ; //} @@ -444,7 +444,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog($"Errore in flog{Environment.NewLine}{exc}"); + // logger.lg.scriviLog($"Errore in flog{Envir.NewLine}{exc}"); // answ = "NO"; // } // return answ; @@ -484,7 +484,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog($"Errore in fase deserializzazione flogJson{Environment.NewLine}{exc}"); + // logger.lg.scriviLog($"Errore in fase deserializzazione flogJson{Envir.NewLine}{exc}"); // answ = "NO"; // } // // se ho qualcosa da processare... @@ -506,7 +506,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog($"Errore in fase invio valori flogJson{Environment.NewLine}{exc}"); + // logger.lg.scriviLog($"Errore in fase invio valori flogJson{Envir.NewLine}{exc}"); // answ = "NO"; // } // // leggo parametri correnti... @@ -555,7 +555,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog($"Errore in fase salvataggio innovazioni parametri correnti da flogJson{Environment.NewLine}{exc}"); + // logger.lg.scriviLog($"Errore in fase salvataggio innovazioni parametri correnti da flogJson{Envir.NewLine}{exc}"); // answ = "NO"; // } // } @@ -687,7 +687,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog(string.Format("Errore in counter (get){0}{1}", Environment.NewLine, exc)); + // logger.lg.scriviLog(string.Format("Errore in counter (get){0}{1}", Envir.NewLine, exc)); // answ = "NO"; // } // return answ; @@ -710,7 +710,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog(string.Format("Errore in counter TC (get){0}{1}", Environment.NewLine, exc)); + // logger.lg.scriviLog(string.Format("Errore in counter TC (get){0}{1}", Envir.NewLine, exc)); // answ = "NO"; // } // return answ; @@ -764,7 +764,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog(string.Format("Errore in currODL (get){0}{1}", Environment.NewLine, exc)); + // logger.lg.scriviLog(string.Format("Errore in currODL (get){0}{1}", Envir.NewLine, exc)); // answ = "NO"; // } // return answ; @@ -792,7 +792,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog($"Eccezione in recupero getCurrOdlRow{Environment.NewLine}{exc}", tipoLog.EXCEPTION); + // logger.lg.scriviLog($"Eccezione in recupero getCurrOdlRow{Envir.NewLine}{exc}", tipoLog.EXCEPTION); // } // return answ; //} @@ -822,7 +822,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog($"Eccezione in recupero getCurrOdlStart{Environment.NewLine}{exc}", tipoLog.EXCEPTION); + // logger.lg.scriviLog($"Eccezione in recupero getCurrOdlStart{Envir.NewLine}{exc}", tipoLog.EXCEPTION); // } // return answ.ToString("yyyy-MM-dd HH:mm:ss"); //} @@ -879,7 +879,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog($"Eccezione in recupero getCurrStatoRow{Environment.NewLine}{exc}", tipoLog.EXCEPTION); + // logger.lg.scriviLog($"Eccezione in recupero getCurrStatoRow{Envir.NewLine}{exc}", tipoLog.EXCEPTION); // } // return answ; //} @@ -909,7 +909,7 @@ namespace MP.IOC.Controllers // currFile = new MapoSDK.smallFile() // { // fileName = item.Nome, - // content = fileContent.Replace("\r\n", Environment.NewLine) + // content = fileContent.Replace("\r\n", Envir.NewLine) // }; // objFiles.fileList.Add(currFile); // } @@ -918,7 +918,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog($"Errore in uploadFile{Environment.NewLine}{exc}"); + // logger.lg.scriviLog($"Errore in uploadFile{Envir.NewLine}{exc}"); // answ = "NO"; // } // return answ; @@ -958,7 +958,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog($"Eccezione in recupero getIdlePeriod{Environment.NewLine}{exc}", tipoLog.EXCEPTION); + // logger.lg.scriviLog($"Eccezione in recupero getIdlePeriod{Envir.NewLine}{exc}", tipoLog.EXCEPTION); // } // return answ; //} @@ -1189,7 +1189,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog($"Errore in getObjItems{Environment.NewLine}{exc}"); + // logger.lg.scriviLog($"Errore in getObjItems{Envir.NewLine}{exc}"); // answ = "NO"; // } // } @@ -1227,7 +1227,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog($"Errore in getCurrParams{Environment.NewLine}{exc}"); + // logger.lg.scriviLog($"Errore in getCurrParams{Envir.NewLine}{exc}"); // answ = "NO"; // } // } @@ -1391,7 +1391,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog(string.Format("Errore in processInput{0}{1}", Environment.NewLine, exc)); + // logger.lg.scriviLog(string.Format("Errore in processInput{0}{1}", Envir.NewLine, exc)); // answ = "NO"; // } // return answ; @@ -1432,7 +1432,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog($"Errore in liveJson{Environment.NewLine}{exc}"); + // logger.lg.scriviLog($"Errore in liveJson{Envir.NewLine}{exc}"); // answ = "NO"; // } // return answ; @@ -1445,7 +1445,7 @@ namespace MP.IOC.Controllers // DateTime dataOraEvento = DateTime.Now; // if (memLayer.ML.CRI("_logLevel") > 6) // { - // logger.lg.scriviLog($"Valori Live:{Environment.NewLine}idxMacchina: {id}{Environment.NewLine}liveData: {liveData}", tipoLog.INFO); + // logger.lg.scriviLog($"Valori Live:{Envir.NewLine}idxMacchina: {id}{Envir.NewLine}liveData: {liveData}", tipoLog.INFO); // } // try // { @@ -1454,7 +1454,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog($"Errore in liveRec{Environment.NewLine}{exc}"); + // logger.lg.scriviLog($"Errore in liveRec{Envir.NewLine}{exc}"); // answ = "NO"; // } // return answ; @@ -1497,7 +1497,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog($"Errore in fase deserializzazione rawTransfJson{Environment.NewLine}{exc}"); + // logger.lg.scriviLog($"Errore in fase deserializzazione rawTransfJson{Envir.NewLine}{exc}"); // answ = "NO"; // } // // se ho qualcosa da processare... @@ -1559,7 +1559,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog($"Errore in fase invio valori rawTransfJson{Environment.NewLine}{exc}"); + // logger.lg.scriviLog($"Errore in fase invio valori rawTransfJson{Envir.NewLine}{exc}"); // answ = "NO"; // } // } @@ -1726,7 +1726,7 @@ namespace MP.IOC.Controllers // // chiamo metodo update direttamente! // MtcDataModelArchive.man.saveMachineDataItems(id, dataItems); // answ = "OK"; - // logger.lg.scriviLog($"Effettuato salvataggio saveDataItems per id {id}:{Environment.NewLine}{content}"); + // logger.lg.scriviLog($"Effettuato salvataggio saveDataItems per id {id}:{Envir.NewLine}{content}"); // } // } // catch @@ -1757,7 +1757,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog($"Errore in savePzCountInc{Environment.NewLine}{exc}"); + // logger.lg.scriviLog($"Errore in savePzCountInc{Envir.NewLine}{exc}"); // answ = "NO"; // } // return answ; @@ -1848,7 +1848,7 @@ namespace MP.IOC.Controllers // { // if (memLayer.ML.CRI("_logLevel") > 5) // { - // string errore = string.Format("Errore: {0}{1}", Environment.NewLine, exc); + // string errore = string.Format("Errore: {0}{1}", Envir.NewLine, exc); // logger.lg.scriviLog(errore, tipoLog.EXCEPTION); // } // } @@ -1893,7 +1893,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog(string.Format("Errore in counter (set){0}{1}", Environment.NewLine, exc)); + // logger.lg.scriviLog(string.Format("Errore in counter (set){0}{1}", Envir.NewLine, exc)); // } // return answ; //} @@ -1990,7 +1990,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog($"Errore in setCurrParams{Environment.NewLine}{exc}"); + // logger.lg.scriviLog($"Errore in setCurrParams{Envir.NewLine}{exc}"); // answ = "EXC"; // } // } @@ -2016,7 +2016,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog(string.Format("Errore in sLog{0}{1}", Environment.NewLine, exc)); + // logger.lg.scriviLog(string.Format("Errore in sLog{0}{1}", Envir.NewLine, exc)); // answ = "NO"; // } // } @@ -2065,7 +2065,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog($"Errore in ulog{Environment.NewLine}{exc}"); + // logger.lg.scriviLog($"Errore in ulog{Envir.NewLine}{exc}"); // answ = "NO"; // } // return answ; @@ -2106,7 +2106,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog($"Errore in fase deserializzazione ulogJson{Environment.NewLine}{exc}"); + // logger.lg.scriviLog($"Errore in fase deserializzazione ulogJson{Envir.NewLine}{exc}"); // answ = "NO"; // } // // se ho qualcosa da processare... @@ -2128,7 +2128,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog($"Errore in fase invio valori ulogJson{Environment.NewLine}{exc}"); + // logger.lg.scriviLog($"Errore in fase invio valori ulogJson{Envir.NewLine}{exc}"); // answ = "NO"; // } // } @@ -2174,7 +2174,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog($"Errore in uploadFile{Environment.NewLine}{exc}"); + // logger.lg.scriviLog($"Errore in uploadFile{Envir.NewLine}{exc}"); // answ = "NO"; // } // return answ; @@ -2223,7 +2223,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog($"Errore in upsertObjItems{Environment.NewLine}{exc}"); + // logger.lg.scriviLog($"Errore in upsertObjItems{Envir.NewLine}{exc}"); // answ = "NO"; // } // } @@ -2267,7 +2267,7 @@ namespace MP.IOC.Controllers // } // catch (Exception exc) // { - // logger.lg.scriviLog($"Errore in {caller}{Environment.NewLine}{exc}"); + // logger.lg.scriviLog($"Errore in {caller}{Envir.NewLine}{exc}"); // answ = "NO"; // } diff --git a/MP.IOC/Resources/ChangeLog.html b/MP.IOC/Resources/ChangeLog.html index 8d950f80..f23403c1 100644 --- a/MP.IOC/Resources/ChangeLog.html +++ b/MP.IOC/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MP-IOC -

Versione: 6.16.2604.712

+

Versione: 6.16.2604.807


Note di rilascio:
  • diff --git a/MP.IOC/Resources/VersNum.txt b/MP.IOC/Resources/VersNum.txt index e400f432..30d146d4 100644 --- a/MP.IOC/Resources/VersNum.txt +++ b/MP.IOC/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2604.712 +6.16.2604.807 diff --git a/MP.IOC/Resources/manifest.xml b/MP.IOC/Resources/manifest.xml index 50c81a3b..6dae4f08 100644 --- a/MP.IOC/Resources/manifest.xml +++ b/MP.IOC/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2604.712 + 6.16.2604.807 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 diff --git a/MP.IOC/Services/MetricsDbFlushService.cs b/MP.IOC/Services/MetricsDbFlushService.cs index 1050ef60..f55b34b9 100644 --- a/MP.IOC/Services/MetricsDbFlushService.cs +++ b/MP.IOC/Services/MetricsDbFlushService.cs @@ -64,8 +64,8 @@ namespace MP.IOC.Services Log.Info("Starting historical metrics recovery from Redis..."); var baseKey = _config.GetValue("ServerConf:RedisBaseKey") ?? "MP_IOC"; - var lastHour = DateTime.UtcNow.AddHours(-1); - var yesterday = DateTime.UtcNow.AddDays(-1).Date; + var lastHour = DateTime.Now.AddHours(-1); + var yesterday = DateTime.Now.AddDays(-1).Date; var methods = await GetAllMethodsAsync(); @@ -77,7 +77,7 @@ namespace MP.IOC.Services if (!_db.KeyExists(hoursIndexKey) && !_db.KeyExists(daysIndexKey)) continue; await RecoverHistoricalHourlyAsync(method, hoursIndexKey, lastHour); - + if (deleteConfirmed) { await RecoverHistoricalDailyAsync(method, daysIndexKey, yesterday); @@ -119,7 +119,7 @@ namespace MP.IOC.Services recordsToInsert.Add(new StatsAggregatedModel { Hour = hourFromKey.Date.AddHours(hourFromKey.Hour), - Type = method, + Envir = parts.Length > 4 ? parts[4] : "unknown", RequestCount = (long)score.Value, AvgDuration = 0, MinDuration = 0, @@ -136,14 +136,13 @@ namespace MP.IOC.Services await using var scope = _scopeFactory.CreateAsyncScope(); var _aggrService = scope.ServiceProvider.GetRequiredService(); await _aggrService.UpsertManyAsync(recordsToInsert, false); - Log.Info("[HISTORICAL] Recovered {count} hourly records for method {method}", recordsToInsert.Count, method); + Log.Info($"[HISTORICAL] Recovered {recordsToInsert.Count} hourly records for method {method}"); var sampleCount = Math.Min(5, recordsToInsert.Count); for (int i = 0; i < sampleCount; i++) { var r = recordsToInsert[i]; - Log.Info("[HISTORICAL SAMPLE] Hour={hour}, Type={type}, Count={count}", - r.Hour.ToString("yyyy-MM-dd HH:mm"), r.Type, r.RequestCount); + Log.Info($"[HISTORICAL SAMPLE] Hour={r.Hour:yyyy-MM-dd HH:mm}, Envir={r.Envir}, Count={r.RequestCount}"); } } } @@ -175,7 +174,7 @@ namespace MP.IOC.Services { recordsToInsert.Add(new StatsDetailModel { - Environment = parts.Length > 4 ? parts[4] : "unknown", + Envir = parts.Length > 4 ? parts[4] : "unknown", Type = method, Hour = dayFromKey.Date, RequestCount = (long)score.Value, @@ -201,7 +200,7 @@ namespace MP.IOC.Services { var r = recordsToInsert[i]; Log.Info("[HISTORICAL SAMPLE] Env={env}, Type={type}, Date={date}, Count={count}", - r.Environment, r.Type, r.Hour.ToString("yyyy-MM-dd"), r.RequestCount); + r.Envir, r.Type, r.Hour.ToString("yyyy-MM-dd"), r.RequestCount); } } } @@ -255,7 +254,7 @@ namespace MP.IOC.Services var aggrRecord = new StatsAggregatedModel { Hour = hourStart, - Type = method, + Envir = method, RequestCount = count, AvgDuration = avgDuration, MaxDuration = finalMaxMs, @@ -279,7 +278,7 @@ namespace MP.IOC.Services var detailRecord = new StatsDetailModel { - Environment = destStat.Key, + Envir = destStat.Key, Type = method, Hour = hourStart, RequestCount = detailCount, @@ -303,8 +302,8 @@ namespace MP.IOC.Services for (int i = 0; i < sampleCount; i++) { var r = aggrRecords[i]; - Log.Info("[SAMPLE] INSERT Aggregated: Hour={hour}, Type={type}, Count={count}, Avg={avg:F2}ms, Min={min:F2}ms, Max={max:F2}ms", - r.Hour.ToString("yyyy-MM-dd HH:mm"), r.Type, r.RequestCount, r.AvgDuration, r.MinDuration, r.MaxDuration); + Log.Info("[SAMPLE] INSERT Aggregated: Hour={hour}, Envir={Envir}, Count={count}, Avg={avg:F2}ms, Min={min:F2}ms, Max={max:F2}ms", + r.Hour.ToString("yyyy-MM-dd HH:mm"), r.Envir, r.RequestCount, r.AvgDuration, r.MinDuration, r.MaxDuration); } } @@ -319,7 +318,7 @@ namespace MP.IOC.Services { var r = detailRecords[i]; Log.Info("[SAMPLE] INSERT Detail: Env={env}, Type={type}, Hour={hour}, Count={count}, Avg={avg:F2}ms, Min={min:F2}ms, Max={max:F2}ms", - r.Environment, r.Type, r.Hour.ToString("yyyy-MM-dd HH:mm"), r.RequestCount, r.AvgDuration, r.MinDuration, r.MaxDuration); + r.Envir, r.Type, r.Hour.ToString("yyyy-MM-dd HH:mm"), r.RequestCount, r.AvgDuration, r.MinDuration, r.MaxDuration); } }