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;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using log4net;
|
||||||
using OpenMetaverse.StructuredData;
|
using OpenMetaverse.StructuredData;
|
||||||
|
|
||||||
namespace OpenSim.Framework.Monitoring
|
namespace OpenSim.Framework.Monitoring
|
||||||
|
@ -38,6 +39,8 @@ namespace OpenSim.Framework.Monitoring
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Stat : IDisposable
|
public class Stat : IDisposable
|
||||||
{
|
{
|
||||||
|
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Category of this stat (e.g. cache, scene, etc).
|
/// Category of this stat (e.g. cache, scene, etc).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -204,6 +207,8 @@ namespace OpenSim.Framework.Monitoring
|
||||||
if (m_samples.Count >= m_maxSamples)
|
if (m_samples.Count >= m_maxSamples)
|
||||||
m_samples.Dequeue();
|
m_samples.Dequeue();
|
||||||
|
|
||||||
|
// m_log.DebugFormat("[STAT]: Recording value {0} for {1}", newValue, Name);
|
||||||
|
|
||||||
m_samples.Enqueue(newValue);
|
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 static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
private HttpServerLogWriter httpserverlog = new HttpServerLogWriter();
|
private HttpServerLogWriter httpserverlog = new HttpServerLogWriter();
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This is a pending websocket request before it got an sucessful upgrade response.
|
/// 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
|
/// The consumer must call handler.HandshakeAndUpgrade() to signal to the handler to
|
||||||
|
@ -81,6 +80,11 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public int RequestNumber { get; private set; }
|
public int RequestNumber { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Statistic for holding number of requests processed.
|
||||||
|
/// </summary>
|
||||||
|
private Stat m_requestsProcessedStat;
|
||||||
|
|
||||||
private volatile int NotSocketErrors = 0;
|
private volatile int NotSocketErrors = 0;
|
||||||
public volatile bool HTTPDRunning = false;
|
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);
|
OSHttpRequest req = new OSHttpRequest(context, request);
|
||||||
WebSocketRequestDelegate dWebSocketRequestDelegate = null;
|
WebSocketRequestDelegate dWebSocketRequestDelegate = null;
|
||||||
lock (m_WebSocketHandlers)
|
lock (m_WebSocketHandlers)
|
||||||
|
@ -456,7 +459,6 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
resp.ReuseContext = true;
|
resp.ReuseContext = true;
|
||||||
HandleRequest(req, resp);
|
HandleRequest(req, resp);
|
||||||
|
|
||||||
|
|
||||||
// !!!HACK ALERT!!!
|
// !!!HACK ALERT!!!
|
||||||
// There seems to be a bug in the underlying http code that makes subsequent requests
|
// 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.
|
// 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.
|
// useful without inbound HTTP.
|
||||||
throw e;
|
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)
|
public void httpServerDisconnectMonitor(IHttpClientContext source, SocketError err)
|
||||||
|
@ -1854,6 +1871,9 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
public void Stop()
|
public void Stop()
|
||||||
{
|
{
|
||||||
HTTPDRunning = false;
|
HTTPDRunning = false;
|
||||||
|
|
||||||
|
StatsManager.DeregisterStat(m_requestsProcessedStat);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_PollServiceManager.Stop();
|
m_PollServiceManager.Stop();
|
||||||
|
|
|
@ -34,6 +34,7 @@ using System.Text;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using OpenSim.Framework;
|
using OpenSim.Framework;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
|
using OpenSim.Framework.Monitoring;
|
||||||
using OpenSim.Framework.Servers;
|
using OpenSim.Framework.Servers;
|
||||||
using log4net;
|
using log4net;
|
||||||
using log4net.Config;
|
using log4net.Config;
|
||||||
|
@ -205,6 +206,9 @@ namespace OpenSim.Server.Base
|
||||||
|
|
||||||
public virtual int Run()
|
public virtual int Run()
|
||||||
{
|
{
|
||||||
|
Watchdog.Enabled = true;
|
||||||
|
MemoryWatchdog.Enabled = true;
|
||||||
|
|
||||||
while (m_Running)
|
while (m_Running)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -745,6 +745,7 @@
|
||||||
<Reference name="Mono.Addins.Setup" path="../../../bin/"/>
|
<Reference name="Mono.Addins.Setup" path="../../../bin/"/>
|
||||||
<Reference name="OpenSim.Framework"/>
|
<Reference name="OpenSim.Framework"/>
|
||||||
<Reference name="OpenSim.Framework.Console"/>
|
<Reference name="OpenSim.Framework.Console"/>
|
||||||
|
<Reference name="OpenSim.Framework.Monitoring"/>
|
||||||
<Reference name="OpenSim.Framework.Servers"/>
|
<Reference name="OpenSim.Framework.Servers"/>
|
||||||
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
|
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
|
||||||
<Reference name="Nini" path="../../../bin/"/>
|
<Reference name="Nini" path="../../../bin/"/>
|
||||||
|
|
Loading…
Reference in New Issue