diff options
author | Justin Clarke Casey | 2008-01-23 19:09:50 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-01-23 19:09:50 +0000 |
commit | 257f2b5583b79d37bc61db961c7404346e39725e (patch) | |
tree | 6f835730aeca8faa97c0039cf54498b22caa5c19 /OpenSim/Grid/AssetServer/RestService.cs | |
parent | * Library scripts can now be dragged into prims (diff) | |
download | opensim-SC-257f2b5583b79d37bc61db961c7404346e39725e.zip opensim-SC-257f2b5583b79d37bc61db961c7404346e39725e.tar.gz opensim-SC-257f2b5583b79d37bc61db961c7404346e39725e.tar.bz2 opensim-SC-257f2b5583b79d37bc61db961c7404346e39725e.tar.xz |
* Add very very very basic initial statistical information collection to asset server
* stats can be seen by typing stats on the asset server command line
* Currently collecting only raw requests for today and yesterday
* And I haven't yet tested the 24 hour rollover
Diffstat (limited to 'OpenSim/Grid/AssetServer/RestService.cs')
-rw-r--r-- | OpenSim/Grid/AssetServer/RestService.cs | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/OpenSim/Grid/AssetServer/RestService.cs b/OpenSim/Grid/AssetServer/RestService.cs index ee44108..36dcdb0 100644 --- a/OpenSim/Grid/AssetServer/RestService.cs +++ b/OpenSim/Grid/AssetServer/RestService.cs | |||
@@ -42,7 +42,18 @@ namespace OpenSim.Grid.AssetServer | |||
42 | { | 42 | { |
43 | private OpenAsset_Main m_assetManager; | 43 | private OpenAsset_Main m_assetManager; |
44 | private IAssetProvider m_assetProvider; | 44 | private IAssetProvider m_assetProvider; |
45 | private AssetStatsReporter m_stats; | ||
45 | 46 | ||
47 | public GetAssetStreamHandler(OpenAsset_Main assetManager, IAssetProvider assetProvider, | ||
48 | AssetStatsReporter stats) | ||
49 | : base("GET", "/assets") | ||
50 | { | ||
51 | MainLog.Instance.Verbose("REST", "In Get Request"); | ||
52 | m_assetManager = assetManager; | ||
53 | m_assetProvider = assetProvider; | ||
54 | m_stats = stats; | ||
55 | } | ||
56 | |||
46 | public override byte[] Handle(string path, Stream request) | 57 | public override byte[] Handle(string path, Stream request) |
47 | { | 58 | { |
48 | MainLog.Instance.Verbose("REST", "In Handle"); | 59 | MainLog.Instance.Verbose("REST", "In Handle"); |
@@ -57,6 +68,8 @@ namespace OpenSim.Grid.AssetServer | |||
57 | LLUUID assetID = LLUUID.Parse(p[0]); | 68 | LLUUID assetID = LLUUID.Parse(p[0]); |
58 | 69 | ||
59 | MainLog.Instance.Verbose("REST", "GET:/asset fetch param={0} UUID={1}", param, assetID); | 70 | MainLog.Instance.Verbose("REST", "GET:/asset fetch param={0} UUID={1}", param, assetID); |
71 | m_stats.AddRequest(); | ||
72 | |||
60 | AssetBase asset = m_assetProvider.FetchAsset(assetID); | 73 | AssetBase asset = m_assetProvider.FetchAsset(assetID); |
61 | if (asset != null) | 74 | if (asset != null) |
62 | { | 75 | { |
@@ -70,7 +83,7 @@ namespace OpenSim.Grid.AssetServer | |||
70 | xw.Flush(); | 83 | xw.Flush(); |
71 | 84 | ||
72 | ms.Seek(0, SeekOrigin.Begin); | 85 | ms.Seek(0, SeekOrigin.Begin); |
73 | StreamReader sr = new StreamReader(ms); | 86 | //StreamReader sr = new StreamReader(ms); |
74 | 87 | ||
75 | result = ms.GetBuffer(); | 88 | result = ms.GetBuffer(); |
76 | MainLog.Instance.Verbose("REST", "Buffer: {0}", result); | 89 | MainLog.Instance.Verbose("REST", "Buffer: {0}", result); |
@@ -88,14 +101,6 @@ namespace OpenSim.Grid.AssetServer | |||
88 | } | 101 | } |
89 | return result; | 102 | return result; |
90 | } | 103 | } |
91 | |||
92 | public GetAssetStreamHandler(OpenAsset_Main assetManager, IAssetProvider assetProvider) | ||
93 | : base("GET", "/assets") | ||
94 | { | ||
95 | MainLog.Instance.Verbose("REST", "In Get Request"); | ||
96 | m_assetManager = assetManager; | ||
97 | m_assetProvider = assetProvider; | ||
98 | } | ||
99 | } | 104 | } |
100 | 105 | ||
101 | public class PostAssetStreamHandler : BaseStreamHandler | 106 | public class PostAssetStreamHandler : BaseStreamHandler |
@@ -129,4 +134,4 @@ namespace OpenSim.Grid.AssetServer | |||
129 | m_assetProvider = assetProvider; | 134 | m_assetProvider = assetProvider; |
130 | } | 135 | } |
131 | } | 136 | } |
132 | } \ No newline at end of file | 137 | } |