diff --git a/EgwCoreLib.Lux.Data/Services/BaseServ.cs b/EgwCoreLib.Lux.Data/Services/BaseServ.cs index b60359c6..fce6c234 100644 --- a/EgwCoreLib.Lux.Data/Services/BaseServ.cs +++ b/EgwCoreLib.Lux.Data/Services/BaseServ.cs @@ -184,7 +184,6 @@ namespace EgwCoreLib.Lux.Data.Services var activity = ActivitySource.StartActivity(methodName ?? "UNDEF"); activity?.SetTag("host.name", Environment.MachineName); return activity; - //return ActivitySource.StartActivity(methodName); } @@ -268,7 +267,7 @@ namespace EgwCoreLib.Lux.Data.Services /// Helper trace messaggio log (SE abilitato) /// /// - protected void LogTrace(string traceMsg, NLog.LogLevel? reqLevel = null) + protected void LogTrace(string traceMsg, NLog.LogLevel? reqLevel = null, [CallerMemberName] string? methodName = null) { if (!traceEnabled) return; @@ -276,7 +275,7 @@ namespace EgwCoreLib.Lux.Data.Services reqLevel ??= NLog.LogLevel.Debug; // Loggo! - Log.Log(reqLevel, traceMsg); + Log.Log(reqLevel, $"{methodName} | {traceMsg}"); } #endregion Protected Methods diff --git a/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs b/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs index 140b9f2d..c9e98418 100644 --- a/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs +++ b/EgwCoreLib.Lux.Data/Services/DataLayerServices.cs @@ -2306,6 +2306,8 @@ namespace EgwCoreLib.Lux.Data.Services /// public async Task SaveHmlAsync(string uID, Constants.EXECENVIRONMENTS execEnvironment, string rawContent) { + using var activity = StartActivity(); + string source = "DB"; // salvo sul DB il risultato della BOM if (!string.IsNullOrEmpty(rawContent)) { @@ -2316,9 +2318,19 @@ namespace EgwCoreLib.Lux.Data.Services } catch (Exception exc) { - Log.Error($"Eccezione durante SaveHmlAsync | uID: {uID}{Environment.NewLine}{exc}"); + string exMsg = $"Eccezione durante SaveHmlAsync | uID: {uID} | envir: {execEnvironment}"; + LogTrace($"{exMsg}{Environment.NewLine}{exc}", LogLevel.Error); + // traccio errore + activity?.SetStatus(ActivityStatusCode.Error, exc.Message); + activity?.AddEvent(new ActivityEvent("exception", tags: new ActivityTagsCollection { + { "exception.type", exc.GetType().Name }, + { "exception.message", exc.Message }, + { "exception.stacktrace", exc.StackTrace } + })); } } + activity?.SetTag("data.source", source); + LogTrace($"SaveHmlAsync | {source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms"); } /// @@ -2331,12 +2343,16 @@ namespace EgwCoreLib.Lux.Data.Services /// public async Task SaveProdBalanceAsync(string uID, string rGroup, Constants.EXECENVIRONMENTS execEnvironment, string balance) { + using var activity = StartActivity(); + string source = "DB"; // salvo sul DB il risultato della BOM if (!string.IsNullOrEmpty(balance)) { // salvo info balance nel record del DB relativo all'oggetto richiesto await dbController.ProdGroupUpsertBalance(uID, rGroup, balance); } + activity?.SetTag("data.source", source); + LogTrace($"SaveProdBalanceAsync | {source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms"); } /// @@ -2348,12 +2364,16 @@ namespace EgwCoreLib.Lux.Data.Services /// public async Task SaveProdEstimateAsync(string uID, Constants.EXECENVIRONMENTS execEnvironment, string prodEstim) { + using var activity = StartActivity(); + string source = "DB"; // salvo sul DB il risultato della BOM if (!string.IsNullOrEmpty(prodEstim)) { // salvo info balance nel record del DB relativo all'oggetto richiesto await dbController.OrderRowUpsertProdEst(uID, prodEstim); } + activity?.SetTag("data.source", source); + LogTrace($"SaveProdEstimateAsync | {source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms"); } /// @@ -2365,6 +2385,8 @@ namespace EgwCoreLib.Lux.Data.Services /// public async Task SaveProfileListAsync(string uID, Constants.EXECENVIRONMENTS execEnvironment, string rawContent) { + using var activity = StartActivity(); + string source = "DB"; // salvo sul DB il risultato della BOM if (!string.IsNullOrEmpty(rawContent)) { @@ -2375,8 +2397,18 @@ namespace EgwCoreLib.Lux.Data.Services } catch (Exception exc) { - Log.Error($"Eccezione durante SaveProfileListAsync | uID: {uID}{Environment.NewLine}{exc}"); + string exMsg = $"Eccezione durante SaveProfileListAsync | uID: {uID} | envir: {execEnvironment}"; + LogTrace($"{exMsg}{Environment.NewLine}{exc}", LogLevel.Error); + // traccio errore + activity?.SetStatus(ActivityStatusCode.Error, exc.Message); + activity?.AddEvent(new ActivityEvent("exception", tags: new ActivityTagsCollection { + { "exception.type", exc.GetType().Name }, + { "exception.message", exc.Message }, + { "exception.stacktrace", exc.StackTrace } + })); } + activity?.SetTag("data.source", source); + LogTrace($"SaveProfileListAsync | {source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms"); } } @@ -2390,6 +2422,8 @@ namespace EgwCoreLib.Lux.Data.Services /// public async Task SaveProfileThreshAsync(string uID, Constants.EXECENVIRONMENTS execEnvironment, string rawThreshold, string rawData) { + using var activity = StartActivity(); + string source = "DB"; // salvo sul DB il risultato della BOM if (!string.IsNullOrEmpty(rawThreshold)) { @@ -2399,8 +2433,18 @@ namespace EgwCoreLib.Lux.Data.Services } catch (Exception exc) { - Log.Error($"Eccezione durante SaveProfileThreshAsync | uID: {uID}{Environment.NewLine}{exc}"); + string exMsg = $"Eccezione durante SaveProfileThreshAsync | uID: {uID} | envir: {execEnvironment}"; + LogTrace($"{exMsg}{Environment.NewLine}{exc}", LogLevel.Error); + // traccio errore + activity?.SetStatus(ActivityStatusCode.Error, exc.Message); + activity?.AddEvent(new ActivityEvent("exception", tags: new ActivityTagsCollection { + { "exception.type", exc.GetType().Name }, + { "exception.message", exc.Message }, + { "exception.stacktrace", exc.StackTrace } + })); } + activity?.SetTag("data.source", source); + LogTrace($"SaveProfileThreshAsync | {source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms"); } } @@ -2411,9 +2455,8 @@ namespace EgwCoreLib.Lux.Data.Services /// public async Task> SellingItemsByEnvirAsync(EgwMultiEngineManager.Data.Constants.EXECENVIRONMENTS envir) { + using var activity = StartActivity(); string source = "DB"; - Stopwatch sw = new Stopwatch(); - sw.Start(); List? result = new List(); // cerco in redis... string currKey = $"{redisBaseKey}:SellingItem:{envir}"; @@ -2434,8 +2477,9 @@ namespace EgwCoreLib.Lux.Data.Services { result = new List(); } - sw.Stop(); - Log.Debug($"SellingItemsByEnvirAsync | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + activity?.SetTag("data.source", source); + LogTrace($"SellingItemsByEnvirAsync | {source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms"); + return result; } @@ -2469,7 +2513,6 @@ namespace EgwCoreLib.Lux.Data.Services } // aggiunta tags + log activity?.SetTag("data.source", source); - //activity?.Stop(); LogTrace($"TagsGetAllAsync | {source} | trace: {activity?.TraceId} | {activity?.Duration.TotalMilliseconds}ms"); return result; } @@ -2964,10 +3007,10 @@ namespace EgwCoreLib.Lux.Data.Services // traccio errore activity?.SetStatus(ActivityStatusCode.Error, exc.Message); activity?.AddEvent(new ActivityEvent("exception", tags: new ActivityTagsCollection { - { "exception.type", exc.GetType().Name }, - { "exception.message", exc.Message }, - { "exception.stacktrace", exc.StackTrace } - })); + { "exception.type", exc.GetType().Name }, + { "exception.message", exc.Message }, + { "exception.stacktrace", exc.StackTrace } + })); } } } diff --git a/Lux.API/Lux.API.csproj b/Lux.API/Lux.API.csproj index e1675695..3b4ceaac 100644 --- a/Lux.API/Lux.API.csproj +++ b/Lux.API/Lux.API.csproj @@ -4,7 +4,7 @@ net8.0 enable enable - 1.1.2603.0619 + 1.1.2603.0709 diff --git a/Lux.UI/Lux.UI.csproj b/Lux.UI/Lux.UI.csproj index 6a086514..c2252b43 100644 --- a/Lux.UI/Lux.UI.csproj +++ b/Lux.UI/Lux.UI.csproj @@ -5,7 +5,7 @@ enable enable aspnet-Lux.UI-a758c101-a2f4-4e38-977d-1c4887dbbd50 - 1.1.2603.0619 + 1.1.2603.0709 diff --git a/Resources/ChangeLog.html b/Resources/ChangeLog.html index 7725afc2..22efc924 100644 --- a/Resources/ChangeLog.html +++ b/Resources/ChangeLog.html @@ -1,6 +1,6 @@ LUX - Web Windows MES -

Versione: 1.1.2603.0619

+

Versione: 1.1.2603.0709


Note di rilascio:
  • diff --git a/Resources/VersNum.txt b/Resources/VersNum.txt index a26ce497..21f815e0 100644 --- a/Resources/VersNum.txt +++ b/Resources/VersNum.txt @@ -1 +1 @@ -1.1.2603.0619 +1.1.2603.0709 diff --git a/Resources/manifest.xml b/Resources/manifest.xml index 53458287..0318eaa6 100644 --- a/Resources/manifest.xml +++ b/Resources/manifest.xml @@ -1,6 +1,6 @@ - 1.1.2603.0619 + 1.1.2603.0709 http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html false