Make number of inbound http requests handled available as a httpserver.<port>.IncomingHTTPRequestsProcessed stat
parent
768e8e363b
commit
9501a583cb
|
@ -27,8 +27,9 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
using log4net;
|
||||
using OpenMetaverse.StructuredData;
|
||||
|
||||
namespace OpenSim.Framework.Monitoring
|
||||
|
@ -38,6 +39,8 @@ namespace OpenSim.Framework.Monitoring
|
|||
/// </summary>
|
||||
public class Stat : IDisposable
|
||||
{
|
||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
/// <summary>
|
||||
/// Category of this stat (e.g. cache, scene, etc).
|
||||
/// </summary>
|
||||
|
@ -204,6 +207,8 @@ namespace OpenSim.Framework.Monitoring
|
|||
if (m_samples.Count >= m_maxSamples)
|
||||
m_samples.Dequeue();
|
||||
|
||||
// m_log.DebugFormat("[STAT]: Recording value {0} for {1}", newValue, Name);
|
||||
|
||||
m_samples.Enqueue(newValue);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
@ -456,7 +459,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
|||
resp.ReuseContext = true;
|
||||
HandleRequest(req, resp);
|
||||
|
||||
|
||||
// !!!HACK ALERT!!!
|
||||
// There seems to be a bug in the underlying http code that makes subsequent requests
|
||||
// come up with trash in Accept headers. Until that gets fixed, we're cleaning them up here.
|
||||
|
@ -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();
|
||||
|
|
|
@ -34,6 +34,7 @@ using System.Text;
|
|||
using System.Xml;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Console;
|
||||
using OpenSim.Framework.Monitoring;
|
||||
using OpenSim.Framework.Servers;
|
||||
using log4net;
|
||||
using log4net.Config;
|
||||
|
@ -205,6 +206,9 @@ namespace OpenSim.Server.Base
|
|||
|
||||
public virtual int Run()
|
||||
{
|
||||
Watchdog.Enabled = true;
|
||||
MemoryWatchdog.Enabled = true;
|
||||
|
||||
while (m_Running)
|
||||
{
|
||||
try
|
||||
|
|
|
@ -745,6 +745,7 @@
|
|||
<Reference name="Mono.Addins.Setup" path="../../../bin/"/>
|
||||
<Reference name="OpenSim.Framework"/>
|
||||
<Reference name="OpenSim.Framework.Console"/>
|
||||
<Reference name="OpenSim.Framework.Monitoring"/>
|
||||
<Reference name="OpenSim.Framework.Servers"/>
|
||||
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
|
||||
<Reference name="Nini" path="../../../bin/"/>
|
||||
|
|
Loading…
Reference in New Issue