Exemplo n.º 1
0
        public void Start(DynamoModel model)
        {
            //Whether enabled or not, we still record the startup.
            var service = Service.Instance;

            //Some clients such as Revit may allow start/close Dynamo multiple times
            //in the same session so register only if the factory is not registered.
            if (service.GetTrackerFactory(GATrackerFactory.Name) == null)
            {
                service.Register(new GATrackerFactory(ANALYTICS_PROPERTY));
            }

            if (true == Configuration.DebugModes.IsEnabled("ADPAnalyticsTracker"))
            {
                if (service.GetTrackerFactory(ADPTrackerFactory.Name) == null)
                {
                    service.Register(new ADPTrackerFactory());
                }
            }

            StabilityCookie.Startup();

            heartbeat = Heartbeat.GetInstance(model);

            logger = new UsageLog("Dynamo", UserId, SessionId);
        }
Exemplo n.º 2
0
        public void Dispose()
        {
            //Are we shutting down clean if so write 'nice shutdown' cookie
            if (DynamoModel.IsCrashing)
            {
                StabilityCookie.WriteCrashingShutdown();
            }
            else
            {
                StabilityCookie.WriteCleanShutdown();
            }

            // If the Analytics Client was initialized, shut it down.
            // Otherwise skip this step because it would cause an exception.
            if (Service.IsInitialized)
            {
                Service.ShutDown();
                // Unregister the GATrackerFactory only after shutdown is recorded.
                // Unregister is required, so that the host app can re-start Analytics service.
                Service.Instance.Unregister(GATrackerFactory.Name);
            }

            if (null != heartbeat)
            {
                Heartbeat.DestroyInstance();
            }
            heartbeat = null;

            if (null != logger)
            {
                logger.Dispose();
            }
            logger = null;
        }
Exemplo n.º 3
0
        private void DestroyInternal()
        {
            //Are we shutting down clean if so write 'nice shutdown' cookie
            if (DynamoModel.IsCrashing)
            {
                StabilityCookie.WriteCrashingShutdown();
            }
            else
            {
                StabilityCookie.WriteCleanShutdown();
            }

            System.Diagnostics.Debug.WriteLine("Heartbeat Destory Internal called");

            shutdownEvent.Set(); // Signal the shutdown event...

            // TODO: Temporary comment out this Join statement. It currently
            // causes Dynamo to go into a deadlock when it is shutdown for the
            // second time on Revit (that's when the HeartbeatThread is trying
            // to call 'GetStringRepOfWorkspaceSync' below (the method has no
            // chance of executing, and therefore, will never return due to the
            // main thread being held up here waiting for the heartbeat thread
            // to end).
            //
            // heartbeatThread.Join(); // ... wait for thread to end.

            heartbeatThread = null;
        }
Exemplo n.º 4
0
        public void Dispose()
        {
            //Are we shutting down clean if so write 'nice shutdown' cookie
            if (DynamoModel.IsCrashing)
            {
                StabilityCookie.WriteCrashingShutdown();
            }
            else
            {
                StabilityCookie.WriteCleanShutdown();
            }

            Service.ShutDown();
            //Unregister the GATrackerFactory only after shutdown is recorded.
            //Unregister is required, so that the host app can re-start Analytics service.
            Service.Instance.Unregister(GATrackerFactory.Name);

            if (null != heartbeat)
            {
                Heartbeat.DestroyInstance();
            }
            heartbeat = null;

            if (null != logger)
            {
                logger.Dispose();
            }
            logger = null;
        }
Exemplo n.º 5
0
        public void Start(DynamoModel model)
        {
            StabilityCookie.Startup();

            heartbeat = Heartbeat.GetInstance(model);

            logger = new UsageLog("Dynamo", UserId, SessionId);
        }
Exemplo n.º 6
0
        public void Start(DynamoModel model)
        {
            //Whether enabled or not, we still record the startup.
            Service.Instance.Register(new GATrackerFactory(ANALYTICS_PROPERTY));

            StabilityCookie.Startup();

            heartbeat = Heartbeat.GetInstance(model);

            logger = new UsageLog("Dynamo", UserId, SessionId);
        }
Exemplo n.º 7
0
 public void Dispose()
 {
     //Are we shutting down clean if so write 'nice shutdown' cookie
     if (DynamoModel.IsCrashing)
     {
         StabilityCookie.WriteCrashingShutdown();
     }
     else
     {
         StabilityCookie.WriteCleanShutdown();
     }
 }
Exemplo n.º 8
0
        private Heartbeat(DynamoModel dynamoModel)
        {
            // KILLDYNSETTINGS - this is provisional - but we need to enforce that Hearbeat is
            // not referencing multiple DynamoModels
            this.dynamoModel = dynamoModel;

            StabilityCookie.Startup();

            startTime       = DateTime.Now;
            heartbeatThread = new Thread(this.ExecThread);
            heartbeatThread.IsBackground = true;
            heartbeatThread.Start();
        }
Exemplo n.º 9
0
        private void ExecThread()
        {
            Thread.Sleep(WARMUP_DELAY_MS);

            while (true)
            {
                try
                {
                    StabilityCookie.WriteUptimeBeat(DateTime.Now.Subtract(startTime));

                    //Disable heartbeat to avoid 150 event/session limit
                    //InstrumentationLogger.LogAnonymousEvent("Heartbeat", "ApplicationLifeCycle", GetVersionString());

                    String usage  = PackFrequencyDict(ComputeNodeFrequencies());
                    String errors = PackFrequencyDict(ComputeErrorFrequencies());

                    Analytics.LogPiiInfo("Node-usage", usage);
                    Analytics.LogPiiInfo("Nodes-with-errors", errors);

                    DynamoModel.OnRequestDispatcherInvoke(
                        () =>
                    {
                        string workspace = dynamoModel.CurrentWorkspace == null ? string.Empty :
                                           dynamoModel.CurrentWorkspace
                                           .GetStringRepOfWorkspace();
                        Analytics.LogPiiInfo("Workspace", workspace);
                    });
                }
                catch (Exception e)
                {
                    Debug.WriteLine("Exception in Heartbeat " + e);
                }

                // The following call will return "true" if the event is
                // signaled, which can only happen when "DestroyInternal"
                // is called as the application is shutting down. Otherwise,
                // when the wait time ellapsed, the loop continues to log
                // the next set of information.
                //
                if (shutdownEvent.WaitOne(HEARTBEAT_INTERVAL_MS))
                {
                    break;
                }
            }
        }
Exemplo n.º 10
0
        public void Dispose()
        {
            //Are we shutting down clean if so write 'nice shutdown' cookie
            if (DynamoModel.IsCrashing)
            {
                StabilityCookie.WriteCrashingShutdown();
            }
            else
            {
                StabilityCookie.WriteCleanShutdown();
            }

            if (null != heartbeat)
            {
                Heartbeat.DestroyInstance();
            }
            heartbeat = null;

            if (null != logger)
            {
                logger.Dispose();
            }
            logger = null;
        }
Exemplo n.º 11
0
 public void Start(DynamoModel model)
 {
     StabilityCookie.Startup();
 }