aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-06-18 23:07:18 +0100
committerJustin Clark-Casey (justincc)2013-06-18 23:07:18 +0100
commit9501a583cbc8fd819d2b13db4f9ad76958520ce7 (patch)
tree925a26099456963b6e87e0d35b6cc57f8a621bd9
parentFix issue where stat samples were accidentally static, so that any additional... (diff)
downloadopensim-SC_OLD-9501a583cbc8fd819d2b13db4f9ad76958520ce7.zip
opensim-SC_OLD-9501a583cbc8fd819d2b13db4f9ad76958520ce7.tar.gz
opensim-SC_OLD-9501a583cbc8fd819d2b13db4f9ad76958520ce7.tar.bz2
opensim-SC_OLD-9501a583cbc8fd819d2b13db4f9ad76958520ce7.tar.xz
Make number of inbound http requests handled available as a httpserver.<port>.IncomingHTTPRequestsProcessed stat
-rw-r--r--OpenSim/Framework/Monitoring/Stats/Stat.cs7
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs30
-rw-r--r--OpenSim/Server/Base/ServicesServerBase.cs4
-rw-r--r--prebuild.xml1
4 files changed, 36 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
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection;
30using System.Text; 31using System.Text;
31 32using log4net;
32using OpenMetaverse.StructuredData; 33using OpenMetaverse.StructuredData;
33 34
34namespace OpenSim.Framework.Monitoring 35namespace 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();
diff --git a/OpenSim/Server/Base/ServicesServerBase.cs b/OpenSim/Server/Base/ServicesServerBase.cs
index 8243900..667cef8 100644
--- a/OpenSim/Server/Base/ServicesServerBase.cs
+++ b/OpenSim/Server/Base/ServicesServerBase.cs
@@ -34,6 +34,7 @@ using System.Text;
34using System.Xml; 34using System.Xml;
35using OpenSim.Framework; 35using OpenSim.Framework;
36using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
37using OpenSim.Framework.Monitoring;
37using OpenSim.Framework.Servers; 38using OpenSim.Framework.Servers;
38using log4net; 39using log4net;
39using log4net.Config; 40using log4net.Config;
@@ -205,6 +206,9 @@ namespace OpenSim.Server.Base
205 206
206 public virtual int Run() 207 public virtual int Run()
207 { 208 {
209 Watchdog.Enabled = true;
210 MemoryWatchdog.Enabled = true;
211
208 while (m_Running) 212 while (m_Running)
209 { 213 {
210 try 214 try
diff --git a/prebuild.xml b/prebuild.xml
index 29c54c1..4cf3b83 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -745,6 +745,7 @@
745 <Reference name="Mono.Addins.Setup" path="../../../bin/"/> 745 <Reference name="Mono.Addins.Setup" path="../../../bin/"/>
746 <Reference name="OpenSim.Framework"/> 746 <Reference name="OpenSim.Framework"/>
747 <Reference name="OpenSim.Framework.Console"/> 747 <Reference name="OpenSim.Framework.Console"/>
748 <Reference name="OpenSim.Framework.Monitoring"/>
748 <Reference name="OpenSim.Framework.Servers"/> 749 <Reference name="OpenSim.Framework.Servers"/>
749 <Reference name="OpenSim.Framework.Servers.HttpServer"/> 750 <Reference name="OpenSim.Framework.Servers.HttpServer"/>
750 <Reference name="Nini" path="../../../bin/"/> 751 <Reference name="Nini" path="../../../bin/"/>