aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-01-28 22:00:38 +0000
committerJustin Clarke Casey2008-01-28 22:00:38 +0000
commitbeefbb46d22d318d1964af16b3e4601e7e23709f (patch)
tree96670d4f9e7c463827e0ff2f394193305dcf65e0
parent* Move AssetStatsReporter to Framework.Statistics (diff)
downloadopensim-SC-beefbb46d22d318d1964af16b3e4601e7e23709f.zip
opensim-SC-beefbb46d22d318d1964af16b3e4601e7e23709f.tar.gz
opensim-SC-beefbb46d22d318d1964af16b3e4601e7e23709f.tar.bz2
opensim-SC-beefbb46d22d318d1964af16b3e4601e7e23709f.tar.xz
* Add total logouts (and total logins) to server side user stats
* Passing the stats collector through object chains is not ideal - this will change when more stats come in * This change will need a prebuild
-rw-r--r--OpenSim/Framework/Communications/UserManagerBase.cs26
-rw-r--r--OpenSim/Framework/Statistics/UserStatsReporter.cs20
-rw-r--r--OpenSim/Grid/UserServer/Main.cs9
-rw-r--r--OpenSim/Grid/UserServer/UserManager.cs13
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs2
-rw-r--r--OpenSim/Region/Communications/Local/LocalUserServices.cs12
-rw-r--r--OpenSim/Region/Examples/SimpleApp/Program.cs2
-rw-r--r--prebuild.xml1
8 files changed, 69 insertions, 16 deletions
diff --git a/OpenSim/Framework/Communications/UserManagerBase.cs b/OpenSim/Framework/Communications/UserManagerBase.cs
index 7e1047f..4967cd9 100644
--- a/OpenSim/Framework/Communications/UserManagerBase.cs
+++ b/OpenSim/Framework/Communications/UserManagerBase.cs
@@ -34,6 +34,7 @@ using libsecondlife;
34using libsecondlife.StructuredData; 34using libsecondlife.StructuredData;
35using Nwc.XmlRpc; 35using Nwc.XmlRpc;
36using OpenSim.Framework.Console; 36using OpenSim.Framework.Console;
37using OpenSim.Framework.Statistics;
37 38
38namespace OpenSim.Framework.UserManagement 39namespace OpenSim.Framework.UserManagement
39{ 40{
@@ -44,8 +45,19 @@ namespace OpenSim.Framework.UserManagement
44 { 45 {
45 public UserConfig _config; 46 public UserConfig _config;
46 private Dictionary<string, IUserData> _plugins = new Dictionary<string, IUserData>(); 47 private Dictionary<string, IUserData> _plugins = new Dictionary<string, IUserData>();
48 protected UserStatsReporter _stats;
47 49
48 /// <summary> 50 /// <summary>
51 /// Constructor.
52 /// </summary>
53 /// <param name="statsCollector">Can be null if stats collection is not required.
54 /// </param>
55 public UserManagerBase(UserStatsReporter statsCollector)
56 {
57 _stats = statsCollector;
58 }
59
60 /// <summary>
49 /// Adds a new user server plugin - user servers will be requested in the order they were loaded. 61 /// Adds a new user server plugin - user servers will be requested in the order they were loaded.
50 /// </summary> 62 /// </summary>
51 /// <param name="FileName">The filename to the user server plugin DLL</param> 63 /// <param name="FileName">The filename to the user server plugin DLL</param>
@@ -411,8 +423,21 @@ namespace OpenSim.Framework.UserManagement
411 423
412 profile.currentAgent = agent; 424 profile.currentAgent = agent;
413 } 425 }
426
427 /// <summary>
428 /// Process a user logoff from OpenSim.
429 /// </summary>
430 /// <param name="userid"></param>
431 /// <param name="regionid"></param>
432 /// <param name="regionhandle"></param>
433 /// <param name="posx"></param>
434 /// <param name="posy"></param>
435 /// <param name="posz"></param>
414 public void LogOffUser(LLUUID userid, LLUUID regionid, ulong regionhandle, float posx, float posy, float posz) 436 public void LogOffUser(LLUUID userid, LLUUID regionid, ulong regionhandle, float posx, float posy, float posz)
415 { 437 {
438 if (_stats != null)
439 _stats.AddLogout();
440
416 UserProfileData userProfile; 441 UserProfileData userProfile;
417 UserAgentData userAgent; 442 UserAgentData userAgent;
418 LLVector3 currentPos = new LLVector3(posx, posy, posz); 443 LLVector3 currentPos = new LLVector3(posx, posy, posz);
@@ -450,6 +475,7 @@ namespace OpenSim.Framework.UserManagement
450 MainLog.Instance.Warn("LOGOUT", "Unknown User logged out"); 475 MainLog.Instance.Warn("LOGOUT", "Unknown User logged out");
451 } 476 }
452 } 477 }
478
453 public void CreateAgent(UserProfileData profile, LLSD request) 479 public void CreateAgent(UserProfileData profile, LLSD request)
454 { 480 {
455 UserAgentData agent = new UserAgentData(); 481 UserAgentData agent = new UserAgentData();
diff --git a/OpenSim/Framework/Statistics/UserStatsReporter.cs b/OpenSim/Framework/Statistics/UserStatsReporter.cs
index 9b3a13f..bd4f95b 100644
--- a/OpenSim/Framework/Statistics/UserStatsReporter.cs
+++ b/OpenSim/Framework/Statistics/UserStatsReporter.cs
@@ -42,7 +42,13 @@ namespace OpenSim.Framework.Statistics
42 public int SuccessfulLoginsToday { get { return successfulLoginsToday; } } 42 public int SuccessfulLoginsToday { get { return successfulLoginsToday; } }
43 43
44 private int successfulLoginsYesterday; 44 private int successfulLoginsYesterday;
45 public int SuccessfulLoginsYesterday { get { return successfulLoginsYesterday; } } 45 public int SuccessfulLoginsYesterday { get { return successfulLoginsYesterday; } }
46
47 private int successfulLogins;
48 public int SuccessfulLogins { get { return successfulLogins; } }
49
50 private int logouts;
51 public int Logouts { get { return logouts; } }
46 52
47 public UserStatsReporter() 53 public UserStatsReporter()
48 { 54 {
@@ -64,8 +70,14 @@ namespace OpenSim.Framework.Statistics
64 /// </summary> 70 /// </summary>
65 public void AddSuccessfulLogin() 71 public void AddSuccessfulLogin()
66 { 72 {
73 successfulLogins++;
67 successfulLoginsToday++; 74 successfulLoginsToday++;
68 } 75 }
76
77 public void AddLogout()
78 {
79 logouts++;
80 }
69 81
70 /// <summary> 82 /// <summary>
71 /// Report back collected statistical information. 83 /// Report back collected statistical information.
@@ -74,9 +86,9 @@ namespace OpenSim.Framework.Statistics
74 public string Report() 86 public string Report()
75 { 87 {
76 return string.Format( 88 return string.Format(
77@"Successful logins today : {0} 89@"Successful logins total : {0}, today : {1}, yesterday : {2}
78Successful logins yesterday : {1}", 90 Logouts total : {3}",
79 SuccessfulLoginsToday, SuccessfulLoginsYesterday); 91 SuccessfulLogins, SuccessfulLoginsToday, SuccessfulLoginsYesterday, Logouts);
80 } 92 }
81 } 93 }
82} 94}
diff --git a/OpenSim/Grid/UserServer/Main.cs b/OpenSim/Grid/UserServer/Main.cs
index 1ae4bee..2650694 100644
--- a/OpenSim/Grid/UserServer/Main.cs
+++ b/OpenSim/Grid/UserServer/Main.cs
@@ -44,7 +44,6 @@ namespace OpenSim.Grid.UserServer
44 { 44 {
45 private UserConfig Cfg; 45 private UserConfig Cfg;
46 46
47
48 public UserManager m_userManager; 47 public UserManager m_userManager;
49 public UserLoginService m_loginService; 48 public UserLoginService m_loginService;
50 public MessageServersConnector m_messagesService; 49 public MessageServersConnector m_messagesService;
@@ -89,13 +88,13 @@ namespace OpenSim.Grid.UserServer
89 public void Startup() 88 public void Startup()
90 { 89 {
91 Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml"))); 90 Cfg = new UserConfig("USER SERVER", (Path.Combine(Util.configDir(), "UserServer_Config.xml")));
91
92 m_stats = new UserStatsReporter();
92 93
93 MainLog.Instance.Verbose("REGION", "Establishing data connection"); 94 MainLog.Instance.Verbose("REGION", "Establishing data connection");
94 m_userManager = new UserManager(); 95 m_userManager = new UserManager(m_stats);
95 m_userManager._config = Cfg; 96 m_userManager._config = Cfg;
96 m_userManager.AddPlugin(Cfg.DatabaseProvider); 97 m_userManager.AddPlugin(Cfg.DatabaseProvider);
97
98 m_stats = new UserStatsReporter();
99 98
100 m_loginService = new UserLoginService( 99 m_loginService = new UserLoginService(
101 m_userManager, new LibraryRootFolder(), m_stats, Cfg, Cfg.DefaultStartupMsg); 100 m_userManager, new LibraryRootFolder(), m_stats, Cfg, Cfg.DefaultStartupMsg);
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs
index 3f2aa5b..778aec1 100644
--- a/OpenSim/Grid/UserServer/UserManager.cs
+++ b/OpenSim/Grid/UserServer/UserManager.cs
@@ -32,16 +32,21 @@ using System.Text.RegularExpressions;
32using libsecondlife; 32using libsecondlife;
33using Nwc.XmlRpc; 33using Nwc.XmlRpc;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Statistics;
35using OpenSim.Framework.UserManagement; 36using OpenSim.Framework.UserManagement;
36 37
37namespace OpenSim.Grid.UserServer 38namespace OpenSim.Grid.UserServer
38{ 39{
39 public class UserManager : UserManagerBase 40 public class UserManager : UserManagerBase
40 { 41 {
41 public UserManager() 42 /// <summary>
43 /// Constructor.
44 /// </summary>
45 /// <param name="statsCollector">Can be null if stats collection is not required.
46 /// </param>
47 public UserManager(UserStatsReporter statsCollector) : base(statsCollector)
42 { 48 {
43 } 49 }
44
45 50
46 /// <summary> 51 /// <summary>
47 /// Deletes an active agent session 52 /// Deletes an active agent session
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index 9484e15..a620bd4 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -317,7 +317,7 @@ namespace OpenSim
317 317
318 LocalUserServices userService = 318 LocalUserServices userService =
319 new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX, 319 new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX,
320 m_networkServersInfo.DefaultHomeLocY, inventoryService); 320 m_networkServersInfo.DefaultHomeLocY, inventoryService, null);
321 userService.AddPlugin(m_standaloneUserPlugin); 321 userService.AddPlugin(m_standaloneUserPlugin);
322 322
323 LocalBackEndServices backendService = new LocalBackEndServices(); 323 LocalBackEndServices backendService = new LocalBackEndServices();
diff --git a/OpenSim/Region/Communications/Local/LocalUserServices.cs b/OpenSim/Region/Communications/Local/LocalUserServices.cs
index e02a600..8a4d4e7 100644
--- a/OpenSim/Region/Communications/Local/LocalUserServices.cs
+++ b/OpenSim/Region/Communications/Local/LocalUserServices.cs
@@ -30,6 +30,7 @@ using System;
30using libsecondlife; 30using libsecondlife;
31using OpenSim.Framework; 31using OpenSim.Framework;
32using OpenSim.Framework.Communications; 32using OpenSim.Framework.Communications;
33using OpenSim.Framework.Statistics;
33using OpenSim.Framework.UserManagement; 34using OpenSim.Framework.UserManagement;
34 35
35namespace OpenSim.Region.Communications.Local 36namespace OpenSim.Region.Communications.Local
@@ -42,8 +43,17 @@ namespace OpenSim.Region.Communications.Local
42 private IInventoryServices m_inventoryService; 43 private IInventoryServices m_inventoryService;
43 44
44 45
46 /// <summary>
47 ///
48 /// </summary>
49 /// <param name="serversInfo"></param>
50 /// <param name="defaultHomeLocX"></param>
51 /// <param name="defaultHomeLocY"></param>
52 /// <param name="inventoryService"></param>
53 /// <param name="statsCollector">Can be null if stats collection is not required.</param>
45 public LocalUserServices(NetworkServersInfo serversInfo, uint defaultHomeLocX, uint defaultHomeLocY, 54 public LocalUserServices(NetworkServersInfo serversInfo, uint defaultHomeLocX, uint defaultHomeLocY,
46 IInventoryServices inventoryService) 55 IInventoryServices inventoryService, UserStatsReporter statsCollector)
56 : base(statsCollector)
47 { 57 {
48 m_serversInfo = serversInfo; 58 m_serversInfo = serversInfo;
49 59
diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs
index 485d657..ff29b11 100644
--- a/OpenSim/Region/Examples/SimpleApp/Program.cs
+++ b/OpenSim/Region/Examples/SimpleApp/Program.cs
@@ -77,7 +77,7 @@ namespace SimpleApp
77 77
78 LocalUserServices userService = 78 LocalUserServices userService =
79 new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX, 79 new LocalUserServices(m_networkServersInfo, m_networkServersInfo.DefaultHomeLocX,
80 m_networkServersInfo.DefaultHomeLocY, inventoryService); 80 m_networkServersInfo.DefaultHomeLocY, inventoryService, null);
81 userService.AddPlugin(m_userPlugin); 81 userService.AddPlugin(m_userPlugin);
82 82
83 LocalBackEndServices backendService = new LocalBackEndServices(); 83 LocalBackEndServices backendService = new LocalBackEndServices();
diff --git a/prebuild.xml b/prebuild.xml
index f000455..4201b96 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -1363,6 +1363,7 @@
1363 <Reference name="OpenSim.Framework"/> 1363 <Reference name="OpenSim.Framework"/>
1364 <Reference name="OpenSim.Framework.Data"/> 1364 <Reference name="OpenSim.Framework.Data"/>
1365 <Reference name="OpenSim.Framework.Console"/> 1365 <Reference name="OpenSim.Framework.Console"/>
1366 <Reference name="OpenSim.Framework.Statistics"/>
1366 <Reference name="OpenSim.Region.Physics.Manager"/> 1367 <Reference name="OpenSim.Region.Physics.Manager"/>
1367 <Reference name="OpenSim.Framework.Servers"/> 1368 <Reference name="OpenSim.Framework.Servers"/>
1368 <Reference name="OpenSim.Region.Environment"/> 1369 <Reference name="OpenSim.Region.Environment"/>