* Add 'asset not found' statistics to grid asset server stats
parent
a70e9c8c2c
commit
881f295e70
|
@ -40,11 +40,15 @@ namespace OpenSim.Grid.AssetServer
|
||||||
private Timer ageStatsTimer = new Timer(24 * 60 * 60 * 1000);
|
private Timer ageStatsTimer = new Timer(24 * 60 * 60 * 1000);
|
||||||
private DateTime startTime = DateTime.Now;
|
private DateTime startTime = DateTime.Now;
|
||||||
|
|
||||||
private long assetRequestsToday;
|
private long assetRequestsToday;
|
||||||
|
private long assetRequestsNotFoundToday;
|
||||||
private long assetRequestsYesterday;
|
private long assetRequestsYesterday;
|
||||||
|
private long assetRequestsNotFoundYesterday;
|
||||||
|
|
||||||
public long AssetRequestsToday { get { return assetRequestsToday; } }
|
public long AssetRequestsToday { get { return assetRequestsToday; } }
|
||||||
public long AssetRequestsYesterday { get { return assetRequestsYesterday; } }
|
public long AssetRequestsNotFoundToday { get { return assetRequestsNotFoundToday; } }
|
||||||
|
public long AssetRequestsYesterday { get { return assetRequestsYesterday; } }
|
||||||
|
public long AssetRequestsNotFoundYesterday { get { return assetRequestsNotFoundYesterday; } }
|
||||||
|
|
||||||
public AssetStatsReporter()
|
public AssetStatsReporter()
|
||||||
{
|
{
|
||||||
|
@ -58,7 +62,18 @@ namespace OpenSim.Grid.AssetServer
|
||||||
|
|
||||||
// There is a possibility that an asset request could occur between the execution of these
|
// There is a possibility that an asset request could occur between the execution of these
|
||||||
// two statements. But we're better off without the synchronization overhead.
|
// two statements. But we're better off without the synchronization overhead.
|
||||||
assetRequestsToday = 0;
|
assetRequestsToday = 0;
|
||||||
|
|
||||||
|
assetRequestsNotFoundYesterday = assetRequestsNotFoundToday;
|
||||||
|
assetRequestsNotFoundToday = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Record that an asset request failed to find an asset
|
||||||
|
/// </summary>
|
||||||
|
public void AddNotFoundRequest()
|
||||||
|
{
|
||||||
|
assetRequestsNotFoundToday++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -82,10 +97,10 @@ namespace OpenSim.Grid.AssetServer
|
||||||
long assetRequestsYesterdayPerHour = (long)Math.Round(AssetRequestsYesterday / 24.0);
|
long assetRequestsYesterdayPerHour = (long)Math.Round(AssetRequestsYesterday / 24.0);
|
||||||
|
|
||||||
return string.Format(
|
return string.Format(
|
||||||
@"Asset requests today : {0} ({1} per hour)
|
@"Asset requests today : {0} ({1} per hour) of which {2} were not found
|
||||||
Asset requests yesterday : {2} ({3} per hour)",
|
Asset requests yesterday : {3} ({4} per hour) of which {5} were not found",
|
||||||
AssetRequestsToday, assetRequestsTodayPerHour,
|
AssetRequestsToday, assetRequestsTodayPerHour, AssetRequestsNotFoundToday,
|
||||||
AssetRequestsYesterday, assetRequestsYesterdayPerHour);
|
AssetRequestsYesterday, assetRequestsYesterdayPerHour, AssetRequestsNotFoundYesterday);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,12 @@ namespace OpenSim.Grid.AssetServer
|
||||||
private IAssetProvider m_assetProvider;
|
private IAssetProvider m_assetProvider;
|
||||||
private AssetStatsReporter m_stats;
|
private AssetStatsReporter m_stats;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="assetManager"></param>
|
||||||
|
/// <param name="assetProvider"></param>
|
||||||
|
/// <param name="stats">Can be null if stats collection isn't required</param>
|
||||||
public GetAssetStreamHandler(OpenAsset_Main assetManager, IAssetProvider assetProvider,
|
public GetAssetStreamHandler(OpenAsset_Main assetManager, IAssetProvider assetProvider,
|
||||||
AssetStatsReporter stats)
|
AssetStatsReporter stats)
|
||||||
: base("GET", "/assets")
|
: base("GET", "/assets")
|
||||||
|
@ -73,8 +79,9 @@ namespace OpenSim.Grid.AssetServer
|
||||||
"REST", "GET:/asset ignoring request with malformed UUID {0}", p[0]);
|
"REST", "GET:/asset ignoring request with malformed UUID {0}", p[0]);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_stats.AddRequest();
|
if (m_stats != null)
|
||||||
|
m_stats.AddRequest();
|
||||||
|
|
||||||
AssetBase asset = m_assetProvider.FetchAsset(assetID);
|
AssetBase asset = m_assetProvider.FetchAsset(assetID);
|
||||||
if (asset != null)
|
if (asset != null)
|
||||||
|
@ -100,6 +107,9 @@ namespace OpenSim.Grid.AssetServer
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (m_stats != null)
|
||||||
|
m_stats.AddNotFoundRequest();
|
||||||
|
|
||||||
MainLog.Instance.Verbose("REST", "GET:/asset failed to find {0}", assetID);
|
MainLog.Instance.Verbose("REST", "GET:/asset failed to find {0}", assetID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue