diff options
author | Justin Clark-Casey (justincc) | 2013-06-18 23:07:18 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-06-18 23:07:18 +0100 |
commit | 9501a583cbc8fd819d2b13db4f9ad76958520ce7 (patch) | |
tree | 925a26099456963b6e87e0d35b6cc57f8a621bd9 /OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |
parent | Fix issue where stat samples were accidentally static, so that any additional... (diff) | |
download | opensim-SC-9501a583cbc8fd819d2b13db4f9ad76958520ce7.zip opensim-SC-9501a583cbc8fd819d2b13db4f9ad76958520ce7.tar.gz opensim-SC-9501a583cbc8fd819d2b13db4f9ad76958520ce7.tar.bz2 opensim-SC-9501a583cbc8fd819d2b13db4f9ad76958520ce7.tar.xz |
Make number of inbound http requests handled available as a httpserver.<port>.IncomingHTTPRequestsProcessed stat
Diffstat (limited to 'OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 30 |
1 files changed, 25 insertions, 5 deletions
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(); |