aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-01-30 22:13:47 +0000
committerJustin Clarke Casey2008-01-30 22:13:47 +0000
commit881f295e702ac30244803fddedef70b242084914 (patch)
tree1bb2afdb87f774a44f555833b79592b1a575386c
parent* Minor asset server message tweak (diff)
downloadopensim-SC_OLD-881f295e702ac30244803fddedef70b242084914.zip
opensim-SC_OLD-881f295e702ac30244803fddedef70b242084914.tar.gz
opensim-SC_OLD-881f295e702ac30244803fddedef70b242084914.tar.bz2
opensim-SC_OLD-881f295e702ac30244803fddedef70b242084914.tar.xz
* Add 'asset not found' statistics to grid asset server stats
-rw-r--r--OpenSim/Framework/Statistics/AssetStatsReporter.cs31
-rw-r--r--OpenSim/Grid/AssetServer/RestService.cs14
2 files changed, 35 insertions, 10 deletions
diff --git a/OpenSim/Framework/Statistics/AssetStatsReporter.cs b/OpenSim/Framework/Statistics/AssetStatsReporter.cs
index 4489c65..bcd3a75 100644
--- a/OpenSim/Framework/Statistics/AssetStatsReporter.cs
+++ b/OpenSim/Framework/Statistics/AssetStatsReporter.cs
@@ -40,11 +40,15 @@ namespace OpenSim.Grid.AssetServer
40 private Timer ageStatsTimer = new Timer(24 * 60 * 60 * 1000); 40 private Timer ageStatsTimer = new Timer(24 * 60 * 60 * 1000);
41 private DateTime startTime = DateTime.Now; 41 private DateTime startTime = DateTime.Now;
42 42
43 private long assetRequestsToday; 43 private long assetRequestsToday;
44 private long assetRequestsNotFoundToday;
44 private long assetRequestsYesterday; 45 private long assetRequestsYesterday;
46 private long assetRequestsNotFoundYesterday;
45 47
46 public long AssetRequestsToday { get { return assetRequestsToday; } } 48 public long AssetRequestsToday { get { return assetRequestsToday; } }
47 public long AssetRequestsYesterday { get { return assetRequestsYesterday; } } 49 public long AssetRequestsNotFoundToday { get { return assetRequestsNotFoundToday; } }
50 public long AssetRequestsYesterday { get { return assetRequestsYesterday; } }
51 public long AssetRequestsNotFoundYesterday { get { return assetRequestsNotFoundYesterday; } }
48 52
49 public AssetStatsReporter() 53 public AssetStatsReporter()
50 { 54 {
@@ -58,7 +62,18 @@ namespace OpenSim.Grid.AssetServer
58 62
59 // There is a possibility that an asset request could occur between the execution of these 63 // There is a possibility that an asset request could occur between the execution of these
60 // two statements. But we're better off without the synchronization overhead. 64 // two statements. But we're better off without the synchronization overhead.
61 assetRequestsToday = 0; 65 assetRequestsToday = 0;
66
67 assetRequestsNotFoundYesterday = assetRequestsNotFoundToday;
68 assetRequestsNotFoundToday = 0;
69 }
70
71 /// <summary>
72 /// Record that an asset request failed to find an asset
73 /// </summary>
74 public void AddNotFoundRequest()
75 {
76 assetRequestsNotFoundToday++;
62 } 77 }
63 78
64 /// <summary> 79 /// <summary>
@@ -82,10 +97,10 @@ namespace OpenSim.Grid.AssetServer
82 long assetRequestsYesterdayPerHour = (long)Math.Round(AssetRequestsYesterday / 24.0); 97 long assetRequestsYesterdayPerHour = (long)Math.Round(AssetRequestsYesterday / 24.0);
83 98
84 return string.Format( 99 return string.Format(
85@"Asset requests today : {0} ({1} per hour) 100@"Asset requests today : {0} ({1} per hour) of which {2} were not found
86Asset requests yesterday : {2} ({3} per hour)", 101Asset requests yesterday : {3} ({4} per hour) of which {5} were not found",
87 AssetRequestsToday, assetRequestsTodayPerHour, 102 AssetRequestsToday, assetRequestsTodayPerHour, AssetRequestsNotFoundToday,
88 AssetRequestsYesterday, assetRequestsYesterdayPerHour); 103 AssetRequestsYesterday, assetRequestsYesterdayPerHour, AssetRequestsNotFoundYesterday);
89 } 104 }
90 } 105 }
91} 106}
diff --git a/OpenSim/Grid/AssetServer/RestService.cs b/OpenSim/Grid/AssetServer/RestService.cs
index 13970e7..9b288a7 100644
--- a/OpenSim/Grid/AssetServer/RestService.cs
+++ b/OpenSim/Grid/AssetServer/RestService.cs
@@ -45,6 +45,12 @@ namespace OpenSim.Grid.AssetServer
45 private IAssetProvider m_assetProvider; 45 private IAssetProvider m_assetProvider;
46 private AssetStatsReporter m_stats; 46 private AssetStatsReporter m_stats;
47 47
48 /// <summary>
49 /// Constructor.
50 /// </summary>
51 /// <param name="assetManager"></param>
52 /// <param name="assetProvider"></param>
53 /// <param name="stats">Can be null if stats collection isn't required</param>
48 public GetAssetStreamHandler(OpenAsset_Main assetManager, IAssetProvider assetProvider, 54 public GetAssetStreamHandler(OpenAsset_Main assetManager, IAssetProvider assetProvider,
49 AssetStatsReporter stats) 55 AssetStatsReporter stats)
50 : base("GET", "/assets") 56 : base("GET", "/assets")
@@ -73,8 +79,9 @@ namespace OpenSim.Grid.AssetServer
73 "REST", "GET:/asset ignoring request with malformed UUID {0}", p[0]); 79 "REST", "GET:/asset ignoring request with malformed UUID {0}", p[0]);
74 return result; 80 return result;
75 } 81 }
76 82
77 m_stats.AddRequest(); 83 if (m_stats != null)
84 m_stats.AddRequest();
78 85
79 AssetBase asset = m_assetProvider.FetchAsset(assetID); 86 AssetBase asset = m_assetProvider.FetchAsset(assetID);
80 if (asset != null) 87 if (asset != null)
@@ -100,6 +107,9 @@ namespace OpenSim.Grid.AssetServer
100 } 107 }
101 else 108 else
102 { 109 {
110 if (m_stats != null)
111 m_stats.AddNotFoundRequest();
112
103 MainLog.Instance.Verbose("REST", "GET:/asset failed to find {0}", assetID); 113 MainLog.Instance.Verbose("REST", "GET:/asset failed to find {0}", assetID);
104 } 114 }
105 } 115 }