Exemplo n.º 1
0
        public void Track(AppMetrAction action)
        {
            if (_stopped)
            {
                throw new Exception("Trying to track after stop!");
            }

            try
            {
                bool flushNeeded;
                lock (_actionList)
                {
                    Interlocked.Add(ref _eventSize, action.CalcApproximateSize());
                    _actionList.Add(action);

                    flushNeeded = IsNeedToFlush();
                }

                if (flushNeeded)
                {
                    _flushTimer.Trigger();
                }
            }
            catch (Exception e)
            {
                Log.Error("Track failed", e);
            }
        }
Exemplo n.º 2
0
        public void Track(AppMetrAction action)
        {
            if (_stopped)
            {
                throw new Exception("Trying to track after stop!");
            }

            try
            {
                bool flushNeeded;
                lock (_actionList)
                {
                    Interlocked.Add(ref _eventSize, action.CalcApproximateSize());
                    _actionList.Add(action);

                    flushNeeded = IsNeedToFlush();
                }

                if (flushNeeded)
                {
                    _flushTimer.Trigger();
                }
            }
            catch (Exception e)
            {
                Log.Error("Track failed", e);
            }
        }
Exemplo n.º 3
0
        public void Track(AppMetrAction action)
        {
            if (_stopped)
            {
                throw new Exception("Trying to track after stop!");
            }

            try
            {
                var currentEventSize = action.CalcApproximateSize();

                bool flushNeeded;
                lock (_actionList)
                {
                    _eventSize += currentEventSize;
                    _actionList.Add(action);

                    flushNeeded = _eventSize >= MaxEventsSize;
                }

                if (flushNeeded)
                {
                    _flushTimer.Trigger();
                }
            }
            catch (Exception e)
            {
                _log.Error("Track failed", e);
            }
        }