public static void OnAppExit(Version version)
        {
            if (!Config.Instance.GoogleAnalytics)
            {
                return;
            }
            var sessionDuration = (DateTime.Now - _appStartTime).TotalSeconds;
            var point           = new InfluxPointBuilder("hdt_app_exit")
                                  .Tag("version", version.ToVersionString(true))
                                  .Tag("new", _new)
                                  .Field("session_duration_seconds", (int)sessionDuration);

#if (SQUIRREL)
            point.Tag("squirrel", true);
#else
            point.Tag("squirrel", false);
#endif

            if (_pctHsReplayDataTotal.HasValue)
            {
                point.Field("pct_hsreplay_data_total", _pctHsReplayDataTotal.Value);
            }
            if (_pctHsReplayData.HasValue)
            {
                point.Field("pct_hsreplay_data_last14d", _pctHsReplayData.Value);
            }

            WritePoint(point.Build());
        }
示例#2
0
        public static void OnAppExit(Version version)
        {
            if (!Config.Instance.GoogleAnalytics)
            {
                return;
            }
            var sessionDuration = (DateTime.Now - _appStartTime).TotalSeconds;
            var point           = new InfluxPointBuilder("hdt_app_exit")
                                  .Tag("version", version.ToVersionString(true))
                                  .Tag("new", _new)
                                  .Tag("stats_window_used", Core.StatsOverviewInitialized)
                                  .Field("session_duration_seconds", (int)sessionDuration);

#if (SQUIRREL)
            point.Tag("squirrel", true);
#else
            point.Tag("squirrel", false);
#endif

            if (_pctHsReplayDataTotal.HasValue)
            {
                point.Field("pct_hsreplay_data_total", _pctHsReplayDataTotal.Value);
            }
            if (_pctHsReplayData.HasValue)
            {
                point.Field("pct_hsreplay_data_last14d", _pctHsReplayData.Value);
            }

            if (_lastMainWindowActivation != null)
            {
                OnMainWindowDeactivated();
            }
            point.Field("window_activations", MainWindowActivations.Count);
            point.Field("window_active_duration", (int)MainWindowActivations.Average());

            WritePoint(point.Build());
        }