private void SendBulkEvents()
        {
            if (wrappedEventsCache.HasReachedMaxSize())
            {
                Logger.Warn("Split SDK events queue is full. Events may have been dropped. Consider increasing capacity.");
            }

            var wrappedEvents = wrappedEventsCache.FetchAllAndClear();

            if (wrappedEvents.Count > 0)
            {
                try
                {
                    var events = wrappedEvents
                                 .Select(x => x.Event)
                                 .ToList();

                    apiClient.SendBulkEvents(events);

                    AcumulateSize = 0;
                }
                catch (Exception e)
                {
                    Logger.Error("Exception caught updating events.", e);
                }
            }
        }
Beispiel #2
0
        public void Log(WrappedEvent wrappedEvent)
        {
            _wrappedEventsCache.AddItems(new List <WrappedEvent> {
                wrappedEvent
            });

            _acumulateSize += wrappedEvent.Size;

            if (_wrappedEventsCache.HasReachedMaxSize() || _acumulateSize >= MAX_SIZE_BYTES)
            {
                SendBulkEvents();
            }
        }
Beispiel #3
0
        public void Log(WrappedEvent wrappedEvent)
        {
            var dropped = _wrappedEventsCache.AddItems(new List <WrappedEvent> {
                wrappedEvent
            });

            if (dropped == 0)
            {
                _acumulateSize += wrappedEvent.Size;
            }

            RecordStats(dropped);

            if (_wrappedEventsCache.HasReachedMaxSize() || _acumulateSize >= MAX_SIZE_BYTES)
            {
                SendBulkEvents();
            }
        }
Beispiel #4
0
        private void SendBulkImpressions()
        {
            if (_impressionsCache.HasReachedMaxSize())
            {
                Logger.Warn("Split SDK impressions queue is full. Impressions may have been dropped. Consider increasing capacity.");
            }

            var impressions = _impressionsCache.FetchAllAndClear();

            if (impressions.Count > 0)
            {
                try
                {
                    _apiClient.SendBulkImpressions(impressions);
                }
                catch (Exception e)
                {
                    Logger.Error("Exception caught updating impressions.", e);
                }
            }
        }