Update gestione routing dati vs redis x record destination

This commit is contained in:
Samuele Locatelli
2026-04-08 08:57:37 +02:00
parent 831ab1de20
commit 7728907b67
2 changed files with 14 additions and 5 deletions
+4 -3
View File
@@ -102,9 +102,11 @@ namespace MP.IOC.Services
try
{
#if false
string sKey = $"{target}|{metodo}";
// Registra scelta
_stats.Record(metodo, target);
_stats.Record(sKey);
#if false
_stats.Record(metodo, target);
#endif
// imposta la Path che vogliamo che YARP appenda al destBase
@@ -118,7 +120,6 @@ namespace MP.IOC.Services
var error = await _forwarder.SendAsync(context, destBase, _httpClientInvoker, requestOptions, _transformer, context.RequestAborted);
sw.Stop();
string sKey = $"{target}|{metodo}";
_stats.RecordDuration(sKey, sw.Elapsed);
#if false
_stats.RecordDuration(metodo, sw.Elapsed);
+10 -2
View File
@@ -41,8 +41,17 @@ namespace MP.IOC.Services
var destStat = stat.Destinations.GetOrAdd(destination, _ => new DestinationStats());
Interlocked.Increment(ref destStat.Count);
}
}
#endif
/// <summary>
/// Registrazione del metodo + destinazione
/// </summary>
/// <param name="dest_method"></param>
public void Record(string dest_method)
{
var stat = _map.GetOrAdd(dest_method, _ => new RouteStats());
Interlocked.Increment(ref stat.Count);
}
/// <summary>
/// Registrazione destinazione+metodo
@@ -55,7 +64,6 @@ namespace MP.IOC.Services
{
lock (stat)
{
stat.Count += 1;
stat.TotalDuration += duration;
if (stat.MaxDuration < duration)