Start recording inter-region teleport attempts, aborts, cancels and failures in statistics for monitoring/debugging purposes

These are recorded as 'entitytransfer' stats as seen by the "show stats entitytransfer" console command.
0.7.4-extended
Justin Clark-Casey (justincc) 2013-03-25 21:24:21 +00:00
parent f6a0294bbc
commit 0f569d2359
1 changed files with 109 additions and 10 deletions

View File

@ -33,6 +33,7 @@ using System.Threading;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Capabilities; using OpenSim.Framework.Capabilities;
using OpenSim.Framework.Client; using OpenSim.Framework.Client;
using OpenSim.Framework.Monitoring;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Region.Physics.Manager; using OpenSim.Region.Physics.Manager;
@ -75,6 +76,31 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
/// </remarks> /// </remarks>
public bool DisableInterRegionTeleportCancellation { get; set; } public bool DisableInterRegionTeleportCancellation { get; set; }
/// <summary>
/// Number of times inter-region teleport was attempted.
/// </summary>
private Stat m_interRegionTeleportAttempts;
/// <summary>
/// Number of times inter-region teleport was aborted (due to simultaneous client logout).
/// </summary>
private Stat m_interRegionTeleportAborts;
/// <summary>
/// Number of times inter-region teleport was successfully cancelled by the client.
/// </summary>
private Stat m_interRegionTeleportCancels;
/// <summary>
/// Number of times inter-region teleport failed due to server/client/network problems (e.g. viewer failed to
/// connect with destination region).
/// </summary>
/// <remarks>
/// This is not necessarily a problem for this simulator - in open-grid/hg conditions, viewer connectivity to
/// destination simulator is unknown.
/// </remarks>
private Stat m_interRegionTeleportFailures;
protected bool m_Enabled = false; protected bool m_Enabled = false;
public Scene Scene { get; private set; } public Scene Scene { get; private set; }
@ -154,6 +180,60 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
Scene = scene; Scene = scene;
m_interRegionTeleportAttempts =
new Stat(
"InterRegionTeleportAttempts",
"Number of inter-region teleports attempted.",
"This does not count attempts which failed due to pre-conditions (e.g. target simulator refused access).\n"
+ "You can get successfully teleports by subtracting aborts, cancels and teleport failures from this figure.",
"",
"entitytransfer",
Scene.Name,
StatType.Push,
null,
StatVerbosity.Debug);
m_interRegionTeleportAborts =
new Stat(
"InterRegionTeleportAborts",
"Number of inter-region teleports aborted due to client actions.",
"The chief action is simultaneous logout whilst teleporting.",
"",
"entitytransfer",
Scene.Name,
StatType.Push,
null,
StatVerbosity.Debug);
m_interRegionTeleportCancels =
new Stat(
"InterRegionTeleportCancels",
"Number of inter-region teleports cancelled by the client.",
null,
"",
"entitytransfer",
Scene.Name,
StatType.Push,
null,
StatVerbosity.Debug);
m_interRegionTeleportFailures =
new Stat(
"InterRegionTeleportFailures",
"Number of inter-region teleports that failed due to server/client/network issues.",
"This number may not be very helpful in open-grid/hg situations as the network connectivity/quality of destinations is uncontrollable.",
"",
"entitytransfer",
Scene.Name,
StatType.Push,
null,
StatVerbosity.Debug);
StatsManager.RegisterStat(m_interRegionTeleportAttempts);
StatsManager.RegisterStat(m_interRegionTeleportAborts);
StatsManager.RegisterStat(m_interRegionTeleportCancels);
StatsManager.RegisterStat(m_interRegionTeleportFailures);
scene.RegisterModuleInterface<IEntityTransferModule>(this); scene.RegisterModuleInterface<IEntityTransferModule>(this);
scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnNewClient += OnNewClient;
} }
@ -171,7 +251,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
public virtual void Close() {} public virtual void Close() {}
public virtual void RemoveRegion(Scene scene) {} public virtual void RemoveRegion(Scene scene)
{
StatsManager.DeregisterStat(m_interRegionTeleportAttempts);
StatsManager.DeregisterStat(m_interRegionTeleportAborts);
StatsManager.DeregisterStat(m_interRegionTeleportCancels);
StatsManager.DeregisterStat(m_interRegionTeleportFailures);
}
public virtual void RegionLoaded(Scene scene) public virtual void RegionLoaded(Scene scene)
{ {
@ -528,6 +614,11 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
return; return;
} }
// Before this point, teleport 'failure' is due to checkable pre-conditions such as whether the target
// simulator can be found and is explicitly prepared to allow access. Therefore, we will not count these
// as server attempts.
m_interRegionTeleportAttempts.Value++;
m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Destination is running version {0}", version); m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Destination is running version {0}", version);
// Fixing a bug where teleporting while sitting results in the avatar ending up removed from // Fixing a bug where teleporting while sitting results in the avatar ending up removed from
@ -578,6 +669,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
bool logout = false; bool logout = false;
if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout)) if (!CreateAgent(sp, reg, finalDestination, agentCircuit, teleportFlags, out reason, out logout))
{ {
m_interRegionTeleportFailures.Value++;
sp.ControllingClient.SendTeleportFailed(String.Format("Teleport refused: {0}", reason)); sp.ControllingClient.SendTeleportFailed(String.Format("Teleport refused: {0}", reason));
m_log.DebugFormat( m_log.DebugFormat(
@ -589,6 +682,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Cancelling) if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Cancelling)
{ {
m_interRegionTeleportCancels.Value++;
m_log.DebugFormat( m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Cancelled teleport of {0} to {1} from {2} after CreateAgent on client request", "[ENTITY TRANSFER MODULE]: Cancelled teleport of {0} to {1} from {2} after CreateAgent on client request",
sp.Name, finalDestination.RegionName, sp.Scene.Name); sp.Name, finalDestination.RegionName, sp.Scene.Name);
@ -597,6 +692,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
} }
else if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting) else if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting)
{ {
m_interRegionTeleportAborts.Value++;
m_log.DebugFormat( m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after CreateAgent due to previous client close.", "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after CreateAgent due to previous client close.",
sp.Name, finalDestination.RegionName, sp.Scene.Name); sp.Name, finalDestination.RegionName, sp.Scene.Name);
@ -666,6 +763,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// establish th econnection to the destination which makes it return true. // establish th econnection to the destination which makes it return true.
if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting) if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting)
{ {
m_interRegionTeleportAborts.Value++;
m_log.DebugFormat( m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} before UpdateAgent", "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} before UpdateAgent",
sp.Name, finalDestination.RegionName, sp.Scene.Name); sp.Name, finalDestination.RegionName, sp.Scene.Name);
@ -681,6 +780,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{ {
if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting) if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting)
{ {
m_interRegionTeleportAborts.Value++;
m_log.DebugFormat( m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after UpdateAgent due to previous client close.", "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after UpdateAgent due to previous client close.",
sp.Name, finalDestination.RegionName, sp.Scene.Name); sp.Name, finalDestination.RegionName, sp.Scene.Name);
@ -698,6 +799,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Cancelling) if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Cancelling)
{ {
m_interRegionTeleportCancels.Value++;
m_log.DebugFormat( m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Cancelled teleport of {0} to {1} from {2} after UpdateAgent on client request", "[ENTITY TRANSFER MODULE]: Cancelled teleport of {0} to {1} from {2} after UpdateAgent on client request",
sp.Name, finalDestination.RegionName, sp.Scene.Name); sp.Name, finalDestination.RegionName, sp.Scene.Name);
@ -733,6 +836,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{ {
if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting) if (m_entityTransferStateMachine.GetAgentTransferState(sp.UUID) == AgentTransferState.Aborting)
{ {
m_interRegionTeleportAborts.Value++;
m_log.DebugFormat( m_log.DebugFormat(
"[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after WaitForAgentArrivedAtDestination due to previous client close.", "[ENTITY TRANSFER MODULE]: Aborted teleport of {0} to {1} from {2} after WaitForAgentArrivedAtDestination due to previous client close.",
sp.Name, finalDestination.RegionName, sp.Scene.Name); sp.Name, finalDestination.RegionName, sp.Scene.Name);
@ -745,6 +850,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName); sp.Name, finalDestination.RegionName, sp.Scene.RegionInfo.RegionName);
Fail(sp, finalDestination, logout, "Destination region did not signal teleport completion."); Fail(sp, finalDestination, logout, "Destination region did not signal teleport completion.");
return; return;
} }
@ -786,15 +892,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
// now we have a child agent in this region. // now we have a child agent in this region.
sp.Reset(); sp.Reset();
} }
// Commented pending deletion since this method no longer appears to do anything at all
// // REFACTORING PROBLEM. Well, not a problem, but this method is HORRIBLE!
// if (sp.Scene.NeedSceneCacheClear(sp.UUID))
// {
// m_log.DebugFormat(
// "[ENTITY TRANSFER MODULE]: User {0} is going to another region, profile cache removed",
// sp.UUID);
// }
} }
/// <summary> /// <summary>
@ -830,6 +927,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{ {
CleanupFailedInterRegionTeleport(sp, finalDestination); CleanupFailedInterRegionTeleport(sp, finalDestination);
m_interRegionTeleportFailures.Value++;
sp.ControllingClient.SendTeleportFailed( sp.ControllingClient.SendTeleportFailed(
string.Format( string.Format(
"Problems connecting to destination {0}, reason: {1}", finalDestination.RegionName, reason)); "Problems connecting to destination {0}, reason: {1}", finalDestination.RegionName, reason));