mirror of
https://github.com/opensim/opensim.git
synced 2026-07-31 22:05:36 +08:00
Make number of inbound http requests handled available as a httpserver.<port>.IncomingHTTPRequestsProcessed stat
This commit is contained in:
@@ -54,7 +54,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
private HttpServerLogWriter httpserverlog = new HttpServerLogWriter();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// This is a pending websocket request before it got an sucessful upgrade response.
|
||||
/// The consumer must call handler.HandshakeAndUpgrade() to signal to the handler to
|
||||
@@ -81,6 +80,11 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
/// </remarks>
|
||||
public int RequestNumber { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Statistic for holding number of requests processed.
|
||||
/// </summary>
|
||||
private Stat m_requestsProcessedStat;
|
||||
|
||||
private volatile int NotSocketErrors = 0;
|
||||
public volatile bool HTTPDRunning = false;
|
||||
|
||||
@@ -436,9 +440,8 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
}
|
||||
}
|
||||
|
||||
public void OnHandleRequestIOThread(IHttpClientContext context, IHttpRequest request)
|
||||
private void OnHandleRequestIOThread(IHttpClientContext context, IHttpRequest request)
|
||||
{
|
||||
|
||||
OSHttpRequest req = new OSHttpRequest(context, request);
|
||||
WebSocketRequestDelegate dWebSocketRequestDelegate = null;
|
||||
lock (m_WebSocketHandlers)
|
||||
@@ -454,8 +457,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
|
||||
OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request),context);
|
||||
resp.ReuseContext = true;
|
||||
HandleRequest(req, resp);
|
||||
|
||||
HandleRequest(req, resp);
|
||||
|
||||
// !!!HACK ALERT!!!
|
||||
// There seems to be a bug in the underlying http code that makes subsequent requests
|
||||
@@ -1824,6 +1826,21 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
// useful without inbound HTTP.
|
||||
throw e;
|
||||
}
|
||||
|
||||
m_requestsProcessedStat
|
||||
= new Stat(
|
||||
"IncomingHTTPRequestsProcessed",
|
||||
"Number of inbound HTTP requests processed",
|
||||
"",
|
||||
"requests",
|
||||
"httpserver",
|
||||
Port.ToString(),
|
||||
StatType.Pull,
|
||||
MeasuresOfInterest.AverageChangeOverTime,
|
||||
stat => stat.Value = RequestNumber,
|
||||
StatVerbosity.Debug);
|
||||
|
||||
StatsManager.RegisterStat(m_requestsProcessedStat);
|
||||
}
|
||||
|
||||
public void httpServerDisconnectMonitor(IHttpClientContext source, SocketError err)
|
||||
@@ -1854,6 +1871,9 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||
public void Stop()
|
||||
{
|
||||
HTTPDRunning = false;
|
||||
|
||||
StatsManager.DeregisterStat(m_requestsProcessedStat);
|
||||
|
||||
try
|
||||
{
|
||||
m_PollServiceManager.Stop();
|
||||
|
||||
Reference in New Issue
Block a user