* Add very basic initial login stats to the user server

* Typing 'stats' on the command line will given total number of successful logins today and yesterday
* A little bit more to come, probably
* Refactoring will follow next
This commit is contained in:
Justin Clarke Casey
2008-01-25 19:24:25 +00:00
parent f96d6ea2cd
commit 90c853685c
10 changed files with 206 additions and 22 deletions

View File

@@ -38,6 +38,7 @@ using Nwc.XmlRpc;
using OpenSim.Framework.Communications.Cache;
using OpenSim.Framework.Console;
using OpenSim.Framework.Statistics;
namespace OpenSim.Framework.UserManagement
{
@@ -47,16 +48,28 @@ namespace OpenSim.Framework.UserManagement
protected UserManagerBase m_userManager = null;
protected Mutex m_loginMutex = new Mutex(false);
protected UserStatsReporter m_statsCollector;
/// <summary>
/// Used during login to send the skeleton of the OpenSim Library to the client.
/// </summary>
protected LibraryRootFolder m_libraryRootFolder;
public LoginService(
UserManagerBase userManager, LibraryRootFolder libraryRootFolder, string welcomeMess)
/// <summary>
/// Constructor
/// </summary>
/// <param name="userManager"></param>
/// <param name="libraryRootFolder"></param>
/// <param name="statsCollector">
/// An object for collecting statistical information.
/// Can be null if statistics are not required</param>
/// <param name="welcomeMess"></param>
public LoginService(UserManagerBase userManager, LibraryRootFolder libraryRootFolder,
UserStatsReporter statsCollector, string welcomeMess)
{
m_userManager = userManager;
m_libraryRootFolder = libraryRootFolder;
m_statsCollector = statsCollector;
if (welcomeMess != String.Empty)
{
@@ -211,6 +224,11 @@ namespace OpenSim.Framework.UserManagement
//return logResponse.ToXmlRpcResponse();
}
CommitAgent(ref userProfile);
// If we reach this point, then the login has successfully logged onto the grid
if (m_statsCollector != null)
m_statsCollector.AddSuccessfulLogin();
return logResponse.ToXmlRpcResponse();
}
@@ -338,6 +356,10 @@ namespace OpenSim.Framework.UserManagement
}
CommitAgent(ref userProfile);
// If we reach this point, then the login has successfully logged onto the grid
if (m_statsCollector != null)
m_statsCollector.AddSuccessfulLogin();
return logResponse.ToLLSDResponse();
}