Update gestione routing dati vs redis x record destination
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user