diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Monitoring/Stats/Stat.cs | 7 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 30 |
2 files changed, 31 insertions, 6 deletions
diff --git a/OpenSim/Framework/Monitoring/Stats/Stat.cs b/OpenSim/Framework/Monitoring/Stats/Stat.cs index 69ac0a5..ca71911 100644 --- a/OpenSim/Framework/Monitoring/Stats/Stat.cs +++ b/OpenSim/Framework/Monitoring/Stats/Stat.cs | |||
@@ -27,8 +27,9 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | ||
30 | using System.Text; | 31 | using System.Text; |
31 | 32 | using log4net; | |
32 | using OpenMetaverse.StructuredData; | 33 | using OpenMetaverse.StructuredData; |
33 | 34 | ||
34 | namespace OpenSim.Framework.Monitoring | 35 | namespace OpenSim.Framework.Monitoring |
@@ -38,6 +39,8 @@ namespace OpenSim.Framework.Monitoring | |||
38 | /// </summary> | 39 | /// </summary> |
39 | public class Stat : IDisposable | 40 | public class Stat : IDisposable |
40 | { | 41 | { |
42 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
43 | |||
41 | /// <summary> | 44 | /// <summary> |
42 | /// Category of this stat (e.g. cache, scene, etc). | 45 | /// Category of this stat (e.g. cache, scene, etc). |
43 | /// </summary> | 46 | /// </summary> |
@@ -204,6 +207,8 @@ namespace OpenSim.Framework.Monitoring | |||
204 | if (m_samples.Count >= m_maxSamples) | 207 | if (m_samples.Count >= m_maxSamples) |
205 | m_samples.Dequeue(); | 208 | m_samples.Dequeue(); |
206 | 209 | ||
210 | // m_log.DebugFormat("[STAT]: Recording value {0} for {1}", newValue, Name); | ||
211 | |||
207 | m_samples.Enqueue(newValue); | 212 | m_samples.Enqueue(newValue); |
208 | } | 213 | } |
209 | } | 214 | } |
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 96a030b..6687441 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -54,7 +54,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
55 | private HttpServerLogWriter httpserverlog = new HttpServerLogWriter(); | 55 | private HttpServerLogWriter httpserverlog = new HttpServerLogWriter(); |
56 | 56 | ||
57 | |||
58 | /// <summary> | 57 | /// <summary> |
59 | /// This is a pending websocket request before it got an sucessful upgrade response. | 58 | /// This is a pending websocket request before it got an sucessful upgrade response. |
60 | /// The consumer must call handler.HandshakeAndUpgrade() to signal to the handler to | 59 | /// The consumer must call handler.HandshakeAndUpgrade() to signal to the handler to |
@@ -81,6 +80,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
81 | /// </remarks> | 80 | /// </remarks> |
82 | public int RequestNumber { get; private set; } | 81 | public int RequestNumber { get; private set; } |
83 | 82 | ||
83 | /// <summary> | ||
84 | /// Statistic for holding number of requests processed. | ||
85 | /// </summary> | ||
86 | private Stat m_requestsProcessedStat; | ||
87 | |||
84 | private volatile int NotSocketErrors = 0; | 88 | private volatile int NotSocketErrors = 0; |
85 | public volatile bool HTTPDRunning = false; | 89 | public volatile bool HTTPDRunning = false; |
86 | 90 | ||
@@ -436,9 +440,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
436 | } | 440 | } |
437 | } | 441 | } |
438 | 442 | ||
439 | public void OnHandleRequestIOThread(IHttpClientContext context, IHttpRequest request) | 443 | private void OnHandleRequestIOThread(IHttpClientContext context, IHttpRequest request) |
440 | { | 444 | { |
441 | |||
442 | OSHttpRequest req = new OSHttpRequest(context, request); | 445 | OSHttpRequest req = new OSHttpRequest(context, request); |
443 | WebSocketRequestDelegate dWebSocketRequestDelegate = null; | 446 | WebSocketRequestDelegate dWebSocketRequestDelegate = null; |
444 | lock (m_WebSocketHandlers) | 447 | lock (m_WebSocketHandlers) |
@@ -454,8 +457,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
454 | 457 | ||
455 | OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request),context); | 458 | OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request),context); |
456 | resp.ReuseContext = true; | 459 | resp.ReuseContext = true; |
457 | HandleRequest(req, resp); | 460 | HandleRequest(req, resp); |
458 | |||
459 | 461 | ||
460 | // !!!HACK ALERT!!! | 462 | // !!!HACK ALERT!!! |
461 | // There seems to be a bug in the underlying http code that makes subsequent requests | 463 | // There seems to be a bug in the underlying http code that makes subsequent requests |
@@ -1824,6 +1826,21 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1824 | // useful without inbound HTTP. | 1826 | // useful without inbound HTTP. |
1825 | throw e; | 1827 | throw e; |
1826 | } | 1828 | } |
1829 | |||
1830 | m_requestsProcessedStat | ||
1831 | = new Stat( | ||
1832 | "IncomingHTTPRequestsProcessed", | ||
1833 | "Number of inbound HTTP requests processed", | ||
1834 | "", | ||
1835 | "requests", | ||
1836 | "httpserver", | ||
1837 | Port.ToString(), | ||
1838 | StatType.Pull, | ||
1839 | MeasuresOfInterest.AverageChangeOverTime, | ||
1840 | stat => stat.Value = RequestNumber, | ||
1841 | StatVerbosity.Debug); | ||
1842 | |||
1843 | StatsManager.RegisterStat(m_requestsProcessedStat); | ||
1827 | } | 1844 | } |
1828 | 1845 | ||
1829 | public void httpServerDisconnectMonitor(IHttpClientContext source, SocketError err) | 1846 | public void httpServerDisconnectMonitor(IHttpClientContext source, SocketError err) |
@@ -1854,6 +1871,9 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1854 | public void Stop() | 1871 | public void Stop() |
1855 | { | 1872 | { |
1856 | HTTPDRunning = false; | 1873 | HTTPDRunning = false; |
1874 | |||
1875 | StatsManager.DeregisterStat(m_requestsProcessedStat); | ||
1876 | |||
1857 | try | 1877 | try |
1858 | { | 1878 | { |
1859 | m_PollServiceManager.Stop(); | 1879 | m_PollServiceManager.Stop(); |