Example #1
0
        private BansheeMetrics()
        {
            banshee_metrics = this;
            string unique_userid = DatabaseConfigurationClient.Client.Get <string> (id_key, null);

            if (String.IsNullOrEmpty(unique_userid))
            {
                unique_userid = System.Guid.NewGuid().ToString();
                DatabaseConfigurationClient.Client.Set <string> (id_key, unique_userid);
            }

            metrics = new MetricsCollection(unique_userid, new DbSampleStore(
                                                ServiceManager.DbConnection, "AnonymousUsageData"
                                                ));

            Configuration.Start();

            if (Application.ActiveClient != null && Application.ActiveClient.IsStarted)
            {
                Initialize(null);
            }
            else
            {
                Application.ClientStarted += Initialize;
            }
        }
 public static void Stop ()
 {
     Log.Information ("Stopping collection of anonymous usage data");
     if (banshee_metrics != null) {
         banshee_metrics.Dispose ();
         banshee_metrics = null;
     }
 }
Example #3
0
 public static void Stop()
 {
     if (banshee_metrics != null)
     {
         Log.Information("Stopping collection of anonymous usage data");
         banshee_metrics.Dispose();
         banshee_metrics = null;
     }
 }
 public static void Start ()
 {
     Log.Information ("Starting collection of anonymous usage data");
     if (banshee_metrics == null) {
         try {
             banshee_metrics = new BansheeMetrics ();
         } catch (Exception e) {
             Hyena.Log.Exception ("Failed to start collection of anonymous usage data", e);
             banshee_metrics = null;
         }
     }
 }
Example #5
0
 public static void Start ()
 {
     // Only enable collection 5% of the time
     var one_in_twenty = new Random ().NextDouble () < 0.05;
     if (one_in_twenty && banshee_metrics == null) {
         Log.Information ("Starting collection of anonymous usage data");
         try {
             banshee_metrics = new BansheeMetrics ();
         } catch (Exception e) {
             Hyena.Log.Exception ("Failed to start collection of anonymous usage data", e);
             banshee_metrics = null;
         }
     }
 }
Example #6
0
        public static void Start()
        {
            // Only enable collection 5% of the time
            var one_in_twenty = new Random().NextDouble() < 0.05;

            if (one_in_twenty && banshee_metrics == null)
            {
                Log.Information("Starting collection of anonymous usage data");
                try {
                    banshee_metrics = new BansheeMetrics();
                } catch (Exception e) {
                    Log.Error("Failed to start collection of anonymous usage data", e);
                    banshee_metrics = null;
                }
            }
        }
        private BansheeMetrics ()
        {
            banshee_metrics = this;
            string unique_userid = DatabaseConfigurationClient.Client.Get<string> (id_key, null);

            if (String.IsNullOrEmpty (unique_userid)) {
                unique_userid = System.Guid.NewGuid ().ToString ();
                DatabaseConfigurationClient.Client.Set<string> (id_key, unique_userid);
            }

            metrics = new MetricsCollection (unique_userid, new DbSampleStore (
                ServiceManager.DbConnection, "AnonymousUsageData"
            ));

            Configuration.Start ();

            if (Application.ActiveClient != null && Application.ActiveClient.IsStarted) {
                Initialize (null);
            } else {
                Application.ClientStarted += Initialize;
            }
        }