Update metodi x usare tracking con Activity vs stopwatch
This commit is contained in:
@@ -1607,16 +1607,16 @@ namespace MP.Data.Controllers
|
||||
/// </summary>
|
||||
/// <param name="newRec"></param>
|
||||
/// <returns></returns>
|
||||
public bool MicroStatoMacchinaUpsert(MicroStatoMacchinaModel newRec)
|
||||
public async Task<bool> MicroStatoMacchinaUpsert(MicroStatoMacchinaModel newRec)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var actRec = dbCtx
|
||||
var actRec = await dbCtx
|
||||
.DbSetMicroStatoMacc
|
||||
.Where(x => x.IdxMacchina == newRec.IdxMacchina)
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault();
|
||||
.FirstOrDefaultAsync();
|
||||
if (actRec == null)
|
||||
{
|
||||
dbCtx
|
||||
@@ -1631,7 +1631,7 @@ namespace MP.Data.Controllers
|
||||
|
||||
dbCtx.Entry(actRec).State = EntityState.Modified;
|
||||
}
|
||||
dbCtx.SaveChanges();
|
||||
await dbCtx.SaveChangesAsync();
|
||||
fatto = true;
|
||||
}
|
||||
return fatto;
|
||||
@@ -1777,15 +1777,14 @@ namespace MP.Data.Controllers
|
||||
/// <param name="idxOdl"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public ODLModel OdlGetByKey(int idxOdl)
|
||||
public async Task<ODLModel> OdlGetByKey(int idxOdl)
|
||||
{
|
||||
ODLModel dbResult = new ODLModel();
|
||||
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
dbResult = await dbCtx
|
||||
.DbSetODL
|
||||
.FirstOrDefault(x => x.IdxOdl == idxOdl);
|
||||
.FirstOrDefaultAsync(x => x.IdxOdl == idxOdl);
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
+384
-370
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP.SPEC</RootNamespace>
|
||||
<Version>6.16.2602.2419</Version>
|
||||
<Version>6.16.2602.2509</Version>
|
||||
<UserSecretsId>1800a78a-6ff1-40f9-b490-87fb8bfc1394</UserSecretsId>
|
||||
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -177,7 +177,7 @@ namespace MP.SPEC.Pages
|
||||
{
|
||||
selAzienda = "*";
|
||||
}
|
||||
ListAziende = await MDService.ElencoAziende();
|
||||
ListAziende = MDService.ElencoAziende();
|
||||
ListTipoArt = await MDService.AnagTipoArtLV();
|
||||
}
|
||||
|
||||
@@ -299,7 +299,7 @@ namespace MP.SPEC.Pages
|
||||
Chiave = "AZIENDA",
|
||||
Valore = value
|
||||
};
|
||||
await MDService.ConfigUpdate(updRec);
|
||||
MDService.ConfigUpdate(updRec);
|
||||
await MDService.ConfigResetCache();
|
||||
// ricarico
|
||||
await Task.Delay(1);
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace MP.SPEC.Pages
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// recupero elenco link
|
||||
ElencoLink = await MDService.ElencoLink();
|
||||
ElencoLink = MDService.ElencoLink();
|
||||
currAzienda = await MDService.ConfigTryGetAsync("AZIENDA");
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace MP.SPEC.Pages
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await getReparto();
|
||||
ListAziende = await MDService.ElencoAziende();
|
||||
ListAziende = MDService.ElencoAziende();
|
||||
var allGruppiData = MDService.ElencoGruppiFase();
|
||||
if (allGruppiData != null)
|
||||
{
|
||||
|
||||
+143
-58
@@ -46,82 +46,167 @@ string redisSrvAddr = connStringRedis.Substring(0, connStringRedis.IndexOf(":"))
|
||||
// avvio oggetto shared x redis...
|
||||
var redisMultiplexer = ConnectionMultiplexer.Connect(connStringRedis);
|
||||
|
||||
// Check develop e conseguente Uptrace setup
|
||||
// CONTROLLO GLOBALE: Tutto questo gira SOLO in Development
|
||||
if (builder.Environment.IsDevelopment())
|
||||
{
|
||||
var uptraceEndpoint = builder.Configuration["UptraceDev:Endpoint"];
|
||||
var uptraceDsn = builder.Configuration["UptraceDev:Dsn"];
|
||||
|
||||
// Se le variabili di configurazione esistono nel json locale, attiviamo la magia
|
||||
if (!string.IsNullOrEmpty(uptraceEndpoint) && !string.IsNullOrEmpty(uptraceDsn))
|
||||
// ====================================================================
|
||||
// Setup Tracing e Telemetria...
|
||||
// ====================================================================
|
||||
|
||||
// 1. Leggiamo la configurazione
|
||||
var otelEnabled = builder.Configuration.GetValue<bool>("Otel:EnableTracing", false);
|
||||
var otelEndpoint = builder.Configuration["Otel:Endpoint"];
|
||||
var otelDsn = builder.Configuration["Otel:Dsn"];
|
||||
|
||||
if (otelEnabled)
|
||||
{
|
||||
// ====================================================================
|
||||
// SETUP OPENTELEMETRY BASE (Genera gli oggetti Activity)
|
||||
// Questo gira per i Livelli 1, 2 e 3.
|
||||
// ====================================================================
|
||||
var appVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "1.0.0";
|
||||
|
||||
builder.Services.AddOpenTelemetry()
|
||||
.WithTracing(tracerProviderBuilder =>
|
||||
{
|
||||
tracerProviderBuilder
|
||||
.SetResourceBuilder(OpenTelemetry.Resources.ResourceBuilder.CreateDefault()
|
||||
.AddService(serviceName: "MAPO.SPEC", serviceVersion: appVersion))
|
||||
.AddSource("MP.DATA.Tracer")
|
||||
.AddAspNetCoreInstrumentation(options => { options.Filter = ctx => !ctx.Request.Path.StartsWithSegments("/health"); })
|
||||
.AddSqlClientInstrumentation(options => { options.RecordException = true; })
|
||||
.AddRedisInstrumentation(redisMultiplexer);
|
||||
|
||||
// ====================================================================
|
||||
// ESPORTAZIONE DI RETE (Solo Livelli 1 e 2)
|
||||
// ====================================================================
|
||||
if (!string.IsNullOrWhiteSpace(otelEndpoint))
|
||||
{
|
||||
tracerProviderBuilder.AddOtlpExporter(options =>
|
||||
{
|
||||
options.Endpoint = new Uri(otelEndpoint);
|
||||
if (!string.IsNullOrWhiteSpace(otelDsn))
|
||||
{
|
||||
options.Headers = $"uptrace-dsn={otelDsn}";
|
||||
}
|
||||
options.Protocol = OpenTelemetry.Exporter.OtlpExportProtocol.Grpc;
|
||||
});
|
||||
}
|
||||
// Se otelEndpoint è vuoto (Livello 3), le tracce nascono e muoiono in RAM.
|
||||
});
|
||||
|
||||
// ====================================================================
|
||||
// ESPORTAZIONE NLOG REALTIME (Solo Livelli 1 e 2)
|
||||
// ====================================================================
|
||||
if (!string.IsNullOrWhiteSpace(otelEndpoint))
|
||||
{
|
||||
// ====================================================================
|
||||
// 1. SETUP NLOG (Per i log in tempo reale)
|
||||
// ====================================================================
|
||||
var otlpTarget = new OtlpTarget
|
||||
{
|
||||
Name = "UptraceRealtime",
|
||||
Endpoint = uptraceEndpoint,
|
||||
ServiceName = "MP.DATA.Tracer",
|
||||
Headers = $"uptrace-dsn={uptraceDsn}"
|
||||
Endpoint = otelEndpoint,
|
||||
ServiceName = "MP.DATA.Tracer"
|
||||
};
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(otelDsn))
|
||||
{
|
||||
otlpTarget.Headers = $"uptrace-dsn={otelDsn}";
|
||||
}
|
||||
|
||||
var config = LogManager.Configuration ?? new NLog.Config.LoggingConfiguration();
|
||||
config.AddTarget(otlpTarget);
|
||||
config.AddRule(NLog.LogLevel.Info, NLog.LogLevel.Fatal, otlpTarget);
|
||||
LogManager.Configuration = config;
|
||||
LogManager.ReconfigExistingLoggers();
|
||||
|
||||
Console.WriteLine("🚀 NLog OTLP Target attivato per Uptrace in Development!");
|
||||
|
||||
// ====================================================================
|
||||
// 2. SETUP OPENTELEMETRY (Per gli Span, HTTP, DB e Redis in tempo reale)
|
||||
// ====================================================================
|
||||
var appVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "1.0.0";
|
||||
|
||||
builder.Services.AddOpenTelemetry()
|
||||
.WithTracing(tracerProviderBuilder =>
|
||||
{
|
||||
tracerProviderBuilder
|
||||
// Definiamo il nome e versione del servizio CORRENTE su Uptrace
|
||||
.SetResourceBuilder(ResourceBuilder.CreateDefault()
|
||||
.AddService(serviceName: "MAPO.SPEC", serviceVersion: appVersion))
|
||||
|
||||
// Diciamo a OTel di ascoltare gli Span manuali generati
|
||||
.AddSource("MP.DATA.Tracer")
|
||||
|
||||
// Strumentazione Automatica
|
||||
.AddAspNetCoreInstrumentation(options =>
|
||||
{
|
||||
options.Filter = (httpContext) => !httpContext.Request.Path.StartsWithSegments("/health");
|
||||
})
|
||||
.AddSqlClientInstrumentation(options =>
|
||||
{
|
||||
options.RecordException = true;
|
||||
})
|
||||
// Assicurati che redisMultiplexer sia inizializzato PRIMA di questo blocco
|
||||
.AddRedisInstrumentation(redisMultiplexer)
|
||||
|
||||
// Esporta i dati verso Uptrace
|
||||
.AddOtlpExporter(options =>
|
||||
{
|
||||
options.Endpoint = new Uri(uptraceEndpoint);
|
||||
options.Headers = $"uptrace-dsn={uptraceDsn}";
|
||||
options.Protocol = OpenTelemetry.Exporter.OtlpExportProtocol.Grpc;
|
||||
});
|
||||
|
||||
// Scommenta per testare in console
|
||||
// .AddConsoleExporter();
|
||||
});
|
||||
|
||||
Console.WriteLine("🚀 OpenTelemetry Tracing attivato per Uptrace in Development!");
|
||||
logger.Info($"🚀 NLog & OTel attivi e in invio verso: {otelEndpoint}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("⚠️ Variabili UptraceDev mancanti nel json. Telemetria realtime disabilitata.");
|
||||
logger.Info("ℹ️ OTel attivo (Local mode). Esportazione di rete disabilitata.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// ====================================================================
|
||||
// LIVELLO 4: TUTTO SPENTO
|
||||
// ====================================================================
|
||||
logger.Info("⏸️ Telemetria e Tracing completamente disabilitati.");
|
||||
}
|
||||
|
||||
//// Check develop e conseguente Uptrace setup
|
||||
//// CONTROLLO GLOBALE: Tutto questo gira SOLO in Development
|
||||
//if (builder.Environment.IsDevelopment())
|
||||
//{
|
||||
// var uptraceEndpoint = builder.Configuration["UptraceDev:Endpoint"];
|
||||
// var uptraceDsn = builder.Configuration["UptraceDev:Dsn"];
|
||||
|
||||
// // Se le variabili di configurazione esistono nel json locale, attiviamo la magia
|
||||
// if (!string.IsNullOrEmpty(uptraceEndpoint) && !string.IsNullOrEmpty(uptraceDsn))
|
||||
// {
|
||||
// // ====================================================================
|
||||
// // 1. SETUP NLOG (Per i log in tempo reale)
|
||||
// // ====================================================================
|
||||
// var otlpTarget = new OtlpTarget
|
||||
// {
|
||||
// Name = "UptraceRealtime",
|
||||
// Endpoint = uptraceEndpoint,
|
||||
// ServiceName = "MP.DATA.Tracer",
|
||||
// Headers = $"uptrace-dsn={uptraceDsn}"
|
||||
// };
|
||||
|
||||
// var config = LogManager.Configuration ?? new NLog.Config.LoggingConfiguration();
|
||||
// config.AddTarget(otlpTarget);
|
||||
// config.AddRule(NLog.LogLevel.Info, NLog.LogLevel.Fatal, otlpTarget);
|
||||
// LogManager.Configuration = config;
|
||||
// LogManager.ReconfigExistingLoggers();
|
||||
|
||||
// Console.WriteLine("🚀 NLog OTLP Target attivato per Uptrace in Development!");
|
||||
|
||||
// // ====================================================================
|
||||
// // 2. SETUP OPENTELEMETRY (Per gli Span, HTTP, DB e Redis in tempo reale)
|
||||
// // ====================================================================
|
||||
// var appVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version?.ToString() ?? "1.0.0";
|
||||
|
||||
// builder.Services.AddOpenTelemetry()
|
||||
// .WithTracing(tracerProviderBuilder =>
|
||||
// {
|
||||
// tracerProviderBuilder
|
||||
// // Definiamo il nome e versione del servizio CORRENTE su Uptrace
|
||||
// .SetResourceBuilder(ResourceBuilder.CreateDefault()
|
||||
// .AddService(serviceName: "MAPO.SPEC", serviceVersion: appVersion))
|
||||
|
||||
// // Diciamo a OTel di ascoltare gli Span manuali generati
|
||||
// .AddSource("MP.DATA.Tracer")
|
||||
|
||||
// // Strumentazione Automatica
|
||||
// .AddAspNetCoreInstrumentation(options =>
|
||||
// {
|
||||
// options.Filter = (httpContext) => !httpContext.Request.Path.StartsWithSegments("/health");
|
||||
// })
|
||||
// .AddSqlClientInstrumentation(options =>
|
||||
// {
|
||||
// options.RecordException = true;
|
||||
// })
|
||||
// // Assicurati che redisMultiplexer sia inizializzato PRIMA di questo blocco
|
||||
// .AddRedisInstrumentation(redisMultiplexer)
|
||||
|
||||
// // Esporta i dati verso Uptrace
|
||||
// .AddOtlpExporter(options =>
|
||||
// {
|
||||
// options.Endpoint = new Uri(uptraceEndpoint);
|
||||
// options.Headers = $"uptrace-dsn={uptraceDsn}";
|
||||
// options.Protocol = OpenTelemetry.Exporter.OtlpExportProtocol.Grpc;
|
||||
// });
|
||||
|
||||
// // Scommenta per testare in console
|
||||
// // .AddConsoleExporter();
|
||||
// });
|
||||
|
||||
// Console.WriteLine("🚀 OpenTelemetry Tracing attivato per Uptrace in Development!");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Console.WriteLine("⚠️ Variabili UptraceDev mancanti nel json. Telemetria realtime disabilitata.");
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
// Add services to the container.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2602.2419</h4>
|
||||
<h4>Versione: 6.16.2602.2509</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2602.2419
|
||||
6.16.2602.2509
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2602.2419</version>
|
||||
<version>6.16.2602.2509</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -41,12 +41,19 @@ namespace MP.SPEC.Shared
|
||||
return MsgService.HasRole(Ruolo);
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
//base.OnInitialized();
|
||||
ElencoLink = MDService.ElencoLink();
|
||||
}
|
||||
|
||||
#if false
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// recupero elenco JQM
|
||||
ElencoLink = await MDService.ElencoLink();
|
||||
await Task.Delay(1);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
protected void ToggleCompress()
|
||||
{
|
||||
|
||||
@@ -6,11 +6,10 @@
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"UptraceDev": {
|
||||
"Otel": {
|
||||
"EnableTracing": true,
|
||||
"Endpoint": "https://uptrace.egalware.com:14317",
|
||||
"Dsn": "https://DC_iX71mEzg7KA7atQEBdQ@uptrace.egalware.com?grpc=14317"
|
||||
//"Endpoint": "http://upt.ovh:14317",
|
||||
//"Dsn": "http://DC_iX71mEzg7KA7atQEBdQ@upt.ovh?grpc=14317"
|
||||
},
|
||||
"ServerConf": {
|
||||
"maxAge": "2000",
|
||||
|
||||
@@ -7,6 +7,11 @@
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
},
|
||||
"Otel": {
|
||||
"EnableTracing": true,
|
||||
"Endpoint": "",
|
||||
"Dsn": ""
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"ConnectionStrings": {
|
||||
"MP.All": "Server=localhost\\SQLEXPRESS;Database=MoonPro; User ID=steamware;Password=viadante16; integrated security=False; MultipleActiveResultSets=True; App=MP.SPEC;",
|
||||
|
||||
@@ -6,6 +6,11 @@
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"Otel": {
|
||||
"EnableTracing": true,
|
||||
"Endpoint": "http://localhost:4317",
|
||||
"Dsn": ""
|
||||
},
|
||||
"ServerConf": {
|
||||
"maxAge": "2000",
|
||||
"cacheCheckArtUsato": 2,
|
||||
|
||||
@@ -46,6 +46,11 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"Otel": {
|
||||
"EnableTracing": true,
|
||||
"Endpoint": "https://uptrace.egalware.com:14317",
|
||||
"Dsn": "https://DC_iX71mEzg7KA7atQEBdQ@uptrace.egalware.com?grpc=14317"
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"ConnectionStrings": {
|
||||
"MP.All": "Server=SQL2016DEV;Database=MoonPro; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.SPEC;",
|
||||
|
||||
Reference in New Issue
Block a user