示例#1
0
        /// <summary>
        /// Sends a pulse timing event to Raygun. The message is sent on a background thread.
        /// </summary>
        /// <param name="eventType">The type of event that occurred.</param>
        /// <param name="name">The name of the event resource such as the activity name or URL of a network call.</param>
        /// <param name="milliseconds">The duration of the event in milliseconds.</param>
        public void SendPulseTimingEvent(RaygunPulseEventType eventType, string name, long milliseconds)
        {
            lock (_batchLock)
            {
                try
                {
                    if (_activeBatch == null)
                    {
                        _activeBatch = new PulseEventBatch(this);
                    }

                    if (_activeBatch != null && !_activeBatch.IsLocked)
                    {
                        EnsurePulseSessionStarted();

                        PendingEvent pendingEvent = new PendingEvent(eventType, name, milliseconds, _sessionId);
                        _activeBatch.Add(pendingEvent);
                    }
                    else
                    {
                        ThreadPool.QueueUserWorkItem(c => SendPulseTimingEventCore(eventType, name, milliseconds));
                    }
                }
                catch (Exception e)
                {
                    System.Diagnostics.Debug.WriteLine(string.Format("Error sending pulse timing event to Raygun: {0}", e.Message));
                }
            }
        }
示例#2
0
        private void SendCore(PulseEventBatch batch)
        {
            try
            {
                if (_sessionId == null)
                {
                    SendPulseSessionEvent(RaygunPulseSessionEventType.SessionStart);
                }

                string version   = GetVersion();
                string os        = "Android";
                string osVersion = Android.OS.Build.VERSION.Release;
                string platform  = string.Format("{0} {1}", Android.OS.Build.Manufacturer, Android.OS.Build.Model);

                RaygunIdentifierMessage user = BuildRaygunIdentifierMessage(null);

                RaygunPulseMessage message = new RaygunPulseMessage();

                System.Diagnostics.Debug.WriteLine("BatchSize: " + batch.PendingEventCount);

                RaygunPulseDataMessage[] eventMessages = new RaygunPulseDataMessage[batch.PendingEventCount];
                int index = 0;
                foreach (PendingEvent pendingEvent in batch.PendingEvents)
                {
                    RaygunPulseDataMessage dataMessage = new RaygunPulseDataMessage();
                    dataMessage.SessionId = pendingEvent.SessionId;
                    dataMessage.Timestamp = pendingEvent.Timestamp;
                    dataMessage.Version   = version;
                    dataMessage.OS        = os;
                    dataMessage.OSVersion = osVersion;
                    dataMessage.Platform  = platform;
                    dataMessage.Type      = "mobile_event_timing";
                    dataMessage.User      = user;

                    string type = pendingEvent.EventType == RaygunPulseEventType.ViewLoaded ? "p" : "n";

                    RaygunPulseData data = new RaygunPulseData()
                    {
                        Name = pendingEvent.Name, Timing = new RaygunPulseTimingMessage()
                        {
                            Type = type, Duration = pendingEvent.Duration
                        }
                    };
                    RaygunPulseData[] dataArray = { data };
                    string            dataStr   = SimpleJson.SerializeObject(dataArray);
                    dataMessage.Data = dataStr;

                    eventMessages[index] = dataMessage;
                    index++;
                }
                message.EventData = eventMessages;

                Send(message);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(string.Format("Error sending pulse event batch to Raygun: {0}", e.Message));
            }
        }
示例#3
0
        private void SendCore(PulseEventBatch batch)
        {
            try
            {
                EnsurePulseSessionStarted();

                string version   = GetVersion();
                string os        = UIDevice.CurrentDevice.SystemName;
                string osVersion = UIDevice.CurrentDevice.SystemVersion;
                string platform  = Mindscape.Raygun4Net.Builders.RaygunEnvironmentMessageBuilder.GetStringSysCtl("hw.machine");

                RaygunPulseMessage message = new RaygunPulseMessage();

                Debug.WriteLine("BatchSize: " + batch.PendingEventCount);

                RaygunPulseDataMessage[] eventMessages = new RaygunPulseDataMessage[batch.PendingEventCount];
                int index = 0;

                foreach (PendingEvent pendingEvent in batch.PendingEvents)
                {
                    RaygunPulseDataMessage dataMessage = new RaygunPulseDataMessage();
                    dataMessage.SessionId = pendingEvent.SessionId;
                    dataMessage.Timestamp = pendingEvent.Timestamp;
                    dataMessage.Version   = version;
                    dataMessage.OS        = os;
                    dataMessage.OSVersion = osVersion;
                    dataMessage.Platform  = platform;
                    dataMessage.Type      = "mobile_event_timing";
                    dataMessage.User      = batch.UserInfo;

                    string type = pendingEvent.EventType == RaygunPulseEventType.ViewLoaded ? "p" : "n";

                    RaygunPulseData data = new RaygunPulseData()
                    {
                        Name   = pendingEvent.Name,
                        Timing = new RaygunPulseTimingMessage()
                        {
                            Type = type, Duration = pendingEvent.Duration
                        }
                    };

                    RaygunPulseData[] dataArray = { data };
                    string            dataStr   = SimpleJson.SerializeObject(dataArray);
                    dataMessage.Data = dataStr;

                    eventMessages[index] = dataMessage;
                    index++;
                }
                message.EventData = eventMessages;

                Send(message);
            }
            catch (Exception e)
            {
                Debug.WriteLine(string.Format("Error sending pulse event batch to Raygun: {0}", e.Message));
            }
        }
示例#4
0
        /// <summary>
        /// Sends a pulse timing event to Raygun. The message is sent on a background thread.
        /// </summary>
        /// <param name="eventType">The type of event that occurred.</param>
        /// <param name="name">The name of the event resource such as the view name or URL of a network call.</param>
        /// <param name="milliseconds">The duration of the event in milliseconds.</param>
        public void SendPulseTimingEvent(RaygunPulseEventType eventType, string name, long milliseconds)
        {
            if (_activeBatch == null)
            {
                _activeBatch = new PulseEventBatch(this);
            }

            if (_activeBatch != null && !_activeBatch.IsLocked)
            {
                if (_sessionId == null)
                {
                    SendPulseSessionEvent(RaygunPulseSessionEventType.SessionStart);
                }
                PendingEvent pendingEvent = new PendingEvent(eventType, name, milliseconds, _sessionId);
                _activeBatch.Add(pendingEvent);
            }
            else
            {
                ThreadPool.QueueUserWorkItem(c => SendPulseTimingEventCore(eventType, name, milliseconds));
            }
        }
示例#5
0
 internal void Send(PulseEventBatch batch)
 {
     ThreadPool.QueueUserWorkItem(c => SendCore(batch));
     _activeBatch = null;
 }
示例#6
0
        private void SendCore(PulseEventBatch batch)
        {
            if (_sessionId == null) {
            SendPulseSessionEvent (RaygunPulseSessionEventType.SessionStart);
              }

              string version = GetVersion ();
              string os = UIDevice.CurrentDevice.SystemName;
              string osVersion = UIDevice.CurrentDevice.SystemVersion;
              string platform = Mindscape.Raygun4Net.Builders.RaygunEnvironmentMessageBuilder.GetStringSysCtl ("hw.machine");

              string machineName = null;
              try {
            machineName = UIDevice.CurrentDevice.Name;
              } catch (Exception e) {
            System.Diagnostics.Debug.WriteLine ("Exception getting device name {0}", e.Message);
              }

              RaygunIdentifierMessage user = BuildRaygunIdentifierMessage (machineName);

              RaygunPulseMessage message = new RaygunPulseMessage ();

              Debug.WriteLine ("BatchSize: " + batch.PendingEventCount);

              RaygunPulseDataMessage [] eventMessages = new RaygunPulseDataMessage[batch.PendingEventCount];
              int index = 0;
              foreach (PendingEvent pendingEvent in batch.PendingEvents) {

            RaygunPulseDataMessage dataMessage = new RaygunPulseDataMessage ();
            dataMessage.SessionId = pendingEvent.SessionId;
            dataMessage.Timestamp = pendingEvent.Timestamp;
            dataMessage.Version = version;
            dataMessage.OS = os;
            dataMessage.OSVersion = osVersion;
            dataMessage.Platform = platform;
            dataMessage.Type = "mobile_event_timing";
            dataMessage.User = user;

            string type = pendingEvent.EventType == RaygunPulseEventType.ViewLoaded ? "p" : "n";

            RaygunPulseData data = new RaygunPulseData () { Name = pendingEvent.Name, Timing = new RaygunPulseTimingMessage () { Type = type, Duration = pendingEvent.Duration } };
            RaygunPulseData [] dataArray = { data };
            string dataStr = SimpleJson.SerializeObject (dataArray);
            dataMessage.Data = dataStr;

            eventMessages [index] = dataMessage;
            index++;
              }
              message.EventData = eventMessages;

              Send (message);
        }
示例#7
0
 internal void Send(PulseEventBatch batch)
 {
     ThreadPool.QueueUserWorkItem (c => SendCore(batch));
       _activeBatch = null;
 }
示例#8
0
        /// <summary>
        /// Sends a pulse timing event to Raygun. The message is sent on a background thread.
        /// </summary>
        /// <param name="eventType">The type of event that occurred.</param>
        /// <param name="name">The name of the event resource such as the view name or URL of a network call.</param>
        /// <param name="milliseconds">The duration of the event in milliseconds.</param>
        public void SendPulseTimingEvent(RaygunPulseEventType eventType, string name, long milliseconds)
        {
            if (_activeBatch == null) {
            _activeBatch = new PulseEventBatch (this);
              }

              if (_activeBatch != null && !_activeBatch.IsLocked) {
            if (_sessionId == null) {
              SendPulseSessionEvent (RaygunPulseSessionEventType.SessionStart);
            }
            PendingEvent pendingEvent = new PendingEvent (eventType, name, milliseconds, _sessionId);
            _activeBatch.Add (pendingEvent);
              } else {
            ThreadPool.QueueUserWorkItem (c => SendPulseTimingEventCore (eventType, name, milliseconds));
              }
        }
示例#9
0
        private void SendCore(PulseEventBatch batch)
        {
            if (_sessionId == null)
            {
                SendPulseSessionEvent(RaygunPulseSessionEventType.SessionStart);
            }

            string version   = GetVersion();
            string os        = UIDevice.CurrentDevice.SystemName;
            string osVersion = UIDevice.CurrentDevice.SystemVersion;
            string platform  = Mindscape.Raygun4Net.Builders.RaygunEnvironmentMessageBuilder.GetStringSysCtl("hw.machine");

            string machineName = null;

            try {
                machineName = UIDevice.CurrentDevice.Name;
            } catch (Exception e) {
                System.Diagnostics.Debug.WriteLine("Exception getting device name {0}", e.Message);
            }

            RaygunIdentifierMessage user = BuildRaygunIdentifierMessage(machineName);

            RaygunPulseMessage message = new RaygunPulseMessage();

            Debug.WriteLine("BatchSize: " + batch.PendingEventCount);

            RaygunPulseDataMessage [] eventMessages = new RaygunPulseDataMessage[batch.PendingEventCount];
            int index = 0;

            foreach (PendingEvent pendingEvent in batch.PendingEvents)
            {
                RaygunPulseDataMessage dataMessage = new RaygunPulseDataMessage();
                dataMessage.SessionId = pendingEvent.SessionId;
                dataMessage.Timestamp = pendingEvent.Timestamp;
                dataMessage.Version   = version;
                dataMessage.OS        = os;
                dataMessage.OSVersion = osVersion;
                dataMessage.Platform  = platform;
                dataMessage.Type      = "mobile_event_timing";
                dataMessage.User      = user;

                string type = pendingEvent.EventType == RaygunPulseEventType.ViewLoaded ? "p" : "n";

                RaygunPulseData data = new RaygunPulseData()
                {
                    Name = pendingEvent.Name, Timing = new RaygunPulseTimingMessage()
                    {
                        Type = type, Duration = pendingEvent.Duration
                    }
                };
                RaygunPulseData [] dataArray = { data };
                string             dataStr   = SimpleJson.SerializeObject(dataArray);
                dataMessage.Data = dataStr;

                eventMessages [index] = dataMessage;
                index++;
            }
            message.EventData = eventMessages;

            Send(message);
        }