Cleanup metodi vari
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MP-IOC </i>
|
||||
<h4>Versione: 6.16.2604.808</h4>
|
||||
<h4>Versione: 6.16.2604.809</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2604.808
|
||||
6.16.2604.809
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2604.808</version>
|
||||
<version>6.16.2604.809</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/MP.IOC.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-IOC/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -58,9 +58,6 @@ namespace MP.IOC.Services
|
||||
{
|
||||
method = rawKey;
|
||||
}
|
||||
#if false
|
||||
var method = kv.Key;
|
||||
#endif
|
||||
var stat = kv.Value;
|
||||
var count = Interlocked.Read(ref stat.Count);
|
||||
var totalMs = stat.TotalDuration.TotalMilliseconds;
|
||||
|
||||
@@ -103,11 +103,9 @@ namespace MP.IOC.Services
|
||||
try
|
||||
{
|
||||
string sKey = $"{target}|{metodo}";
|
||||
|
||||
// Registra scelta
|
||||
_stats.Record(sKey);
|
||||
#if false
|
||||
_stats.Record(metodo, target);
|
||||
#endif
|
||||
|
||||
// imposta la Path che vogliamo che YARP appenda al destBase
|
||||
context.Request.Path = new PathString("/" + relativePath);
|
||||
@@ -121,9 +119,6 @@ namespace MP.IOC.Services
|
||||
|
||||
sw.Stop();
|
||||
_stats.RecordDuration(sKey, sw.Elapsed);
|
||||
#if false
|
||||
_stats.RecordDuration(metodo, sw.Elapsed);
|
||||
#endif
|
||||
|
||||
if (error != ForwarderError.None)
|
||||
{
|
||||
|
||||
@@ -8,41 +8,13 @@ namespace MP.IOC.Services
|
||||
public TimeSpan TotalDuration = TimeSpan.Zero;
|
||||
public TimeSpan MaxDuration = TimeSpan.Zero;
|
||||
public TimeSpan MinDuration = TimeSpan.MaxValue;
|
||||
#if false
|
||||
public ConcurrentDictionary<string, DestinationStats> Destinations = new();
|
||||
#endif
|
||||
public ConcurrentDictionary<int, long> StatusCodes = new();
|
||||
}
|
||||
|
||||
#if false
|
||||
public class DestinationStats
|
||||
{
|
||||
public long Count;
|
||||
public TimeSpan TotalDuration = TimeSpan.Zero;
|
||||
public TimeSpan MaxDuration = TimeSpan.Zero;
|
||||
public TimeSpan MinDuration = TimeSpan.MaxValue;
|
||||
}
|
||||
#endif
|
||||
|
||||
public class RouteStatsManager
|
||||
{
|
||||
private readonly ConcurrentDictionary<string, RouteStats> _map = new();
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Registrazione del metodo + destinazione
|
||||
/// </summary>
|
||||
/// <param name="method"></param>
|
||||
/// <param name="destination"></param>
|
||||
public void Record(string method, string destination)
|
||||
{
|
||||
var stat = _map.GetOrAdd(method, _ => new RouteStats());
|
||||
Interlocked.Increment(ref stat.Count);
|
||||
|
||||
var destStat = stat.Destinations.GetOrAdd(destination, _ => new DestinationStats());
|
||||
Interlocked.Increment(ref destStat.Count);
|
||||
}
|
||||
#endif
|
||||
/// <summary>
|
||||
/// Registrazione del metodo + destinazione
|
||||
/// </summary>
|
||||
@@ -74,25 +46,6 @@ namespace MP.IOC.Services
|
||||
{
|
||||
stat.MinDuration = duration;
|
||||
}
|
||||
|
||||
#if false
|
||||
foreach (var destStat in stat.Destinations.Values)
|
||||
{
|
||||
lock (destStat)
|
||||
{
|
||||
destStat.TotalDuration += duration;
|
||||
|
||||
if (destStat.MaxDuration < duration)
|
||||
{
|
||||
destStat.MaxDuration = duration;
|
||||
}
|
||||
if (destStat.MinDuration > duration)
|
||||
{
|
||||
destStat.MinDuration = duration;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user