Пример #1
0
        private void SendPulseTimingEventCore(RaygunPulseEventType eventType, string name, long milliseconds)
        {
            EnsurePulseSessionStarted();

            RaygunPulseMessage     message     = new RaygunPulseMessage();
            RaygunPulseDataMessage dataMessage = new RaygunPulseDataMessage();

            dataMessage.SessionId = _sessionId;
            dataMessage.Timestamp = DateTime.UtcNow - TimeSpan.FromMilliseconds((long)milliseconds);
            dataMessage.Version   = GetVersion();
            dataMessage.OS        = "Android";
            dataMessage.OSVersion = Android.OS.Build.VERSION.Release;
            dataMessage.Platform  = string.Format("{0} {1}", Android.OS.Build.Manufacturer, Android.OS.Build.Model);
            dataMessage.Type      = "mobile_event_timing";
            dataMessage.User      = UserInfo;

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

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

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

            dataMessage.Data = dataStr;

            message.EventData = new[] { dataMessage };

            Send(message);
        }
Пример #2
0
        private void SendPulseTimingEventCore(RaygunPulseEventType eventType, string name, long milliseconds)
        {
            EnsurePulseSessionStarted();

            RaygunPulseMessage     message     = new RaygunPulseMessage();
            RaygunPulseDataMessage dataMessage = new RaygunPulseDataMessage();

            dataMessage.SessionId = _sessionId;
            dataMessage.Timestamp = DateTime.UtcNow - TimeSpan.FromMilliseconds(milliseconds);
            dataMessage.Version   = GetVersion();
            dataMessage.OS        = UIDevice.CurrentDevice.SystemName;
            dataMessage.OSVersion = UIDevice.CurrentDevice.SystemVersion;
            dataMessage.Platform  = Mindscape.Raygun4Net.Builders.RaygunEnvironmentMessageBuilder.GetStringSysCtl("hw.machine");
            dataMessage.Type      = "mobile_event_timing";
            dataMessage.User      = UserInfo;

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

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

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

            dataMessage.Data = dataStr;

            message.EventData = new [] { dataMessage };

            Send(message);
        }
Пример #3
0
        private RaygunPulseMessage BuildPulseMessage(RaygunPulseSessionEventType type)
        {
            var msg  = new RaygunPulseMessage();
            var data = new RaygunPulseDataMessage();

            data.Timestamp = DateTime.UtcNow;
            data.Version   = GetVersion();
            data.OS        = "Android";
            data.OSVersion = Android.OS.Build.VERSION.Release;
            data.Platform  = string.Format("{0} {1}", Android.OS.Build.Manufacturer, Android.OS.Build.Model);
            data.User      = UserInfo;

            msg.EventData = new[] { data };
            switch (type)
            {
            case RaygunPulseSessionEventType.SessionStart:
                data.Type = "session_start";
                break;

            case RaygunPulseSessionEventType.SessionEnd:
                data.Type = "session_end";
                break;
            }
            data.SessionId = _sessionId;

            return(msg);
        }
Пример #4
0
        private void SendPulseSessionEventCore(RaygunPulseSessionEventType type)
        {
            RaygunPulseMessage     message = new RaygunPulseMessage();
            RaygunPulseDataMessage data    = new RaygunPulseDataMessage();

            data.Timestamp = DateTime.UtcNow;
            data.Version   = GetVersion();

            data.OS        = "Android";
            data.OSVersion = Android.OS.Build.VERSION.Release;
            data.Platform  = string.Format("{0} {1}", Android.OS.Build.Manufacturer, Android.OS.Build.Model);

            data.User         = UserInfo ?? (!String.IsNullOrEmpty(User) ? new RaygunIdentifierMessage(User) : BuildRaygunIdentifierMessage(null));
            message.EventData = new[] { data };
            switch (type)
            {
            case RaygunPulseSessionEventType.SessionStart:
                data.Type = "session_start";
                break;

            case RaygunPulseSessionEventType.SessionEnd:
                data.Type = "session_end";
                break;
            }
            data.SessionId = _sessionId;
            Send(message);
        }
Пример #5
0
        private RaygunPulseMessage BuildPulseMessage(RaygunPulseSessionEventType type)
        {
            var msg  = new RaygunPulseMessage();
            var data = new RaygunPulseDataMessage();

            data.Timestamp = DateTime.UtcNow;
            data.Version   = GetVersion();
            data.OS        = UIDevice.CurrentDevice.SystemName;
            data.OSVersion = UIDevice.CurrentDevice.SystemVersion;
            data.Platform  = Mindscape.Raygun4Net.Builders.RaygunEnvironmentMessageBuilder.GetStringSysCtl("hw.machine");
            data.User      = UserInfo;

            msg.EventData = new[] { data };

            switch (type)
            {
            case RaygunPulseSessionEventType.SessionStart:
                data.Type = "session_start";
                break;

            case RaygunPulseSessionEventType.SessionEnd:
                data.Type = "session_end";
                break;
            }

            data.SessionId = _sessionId;

            return(msg);
        }
Пример #6
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));
            }
        }
Пример #7
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));
            }
        }
Пример #8
0
        private void SendPulseTimingEventCore(RaygunPulseEventType eventType, string name, long milliseconds)
        {
            if (_sessionId == null)
            {
                SendPulseSessionEvent(RaygunPulseSessionEventType.SessionStart);
            }

            RaygunPulseMessage     message     = new RaygunPulseMessage();
            RaygunPulseDataMessage dataMessage = new RaygunPulseDataMessage();

            dataMessage.SessionId = _sessionId;
            dataMessage.Timestamp = DateTime.UtcNow - TimeSpan.FromMilliseconds(milliseconds);
            dataMessage.Version   = GetVersion();
            dataMessage.OS        = UIDevice.CurrentDevice.SystemName;
            dataMessage.OSVersion = UIDevice.CurrentDevice.SystemVersion;
            dataMessage.Platform  = Mindscape.Raygun4Net.Builders.RaygunEnvironmentMessageBuilder.GetStringSysCtl("hw.machine");
            dataMessage.Type      = "mobile_event_timing";

            string machineName = null;

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

            dataMessage.User = BuildRaygunIdentifierMessage(machineName);

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

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

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

            dataMessage.Data = dataStr;

            message.EventData = new [] { dataMessage };

            Send(message);
        }
Пример #9
0
        private void Send(RaygunPulseMessage raygunPulseMessage)
        {
            if (ValidateApiKey())
            {
                string message = null;
                try
                {
                    message = SimpleJson.SerializeObject(raygunPulseMessage);
                }
                catch (Exception ex) {
                    System.Diagnostics.Debug.WriteLine(string.Format("Error serializing message {0}", ex.Message));
                }

                if (message != null)
                {
                    SendPulseMessage(message);
                }
            }
        }
Пример #10
0
        private void Send(RaygunPulseMessage raygunPulseMessage)
        {
            if (ValidateApiKey())
            {
                string message = null;
                try
                {
                    message = SimpleJson.SerializeObject(raygunPulseMessage);
                }
                catch (Exception ex)
                {
                    RaygunLogger.Error(string.Format("Error serializing message {0}", ex.Message));
                }

                if (message != null)
                {
                    SendPulseMessage(message);
                }
            }
        }
Пример #11
0
        private void SendPulseSessionEventCore(RaygunPulseSessionEventType eventType)
        {
            RaygunPulseMessage     message = new RaygunPulseMessage();
            RaygunPulseDataMessage data    = new RaygunPulseDataMessage();

            data.Timestamp = DateTime.UtcNow;
            data.Version   = GetVersion();

            data.OS        = UIDevice.CurrentDevice.SystemName;
            data.OSVersion = UIDevice.CurrentDevice.SystemVersion;
            data.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);
            }
            data.User         = BuildRaygunIdentifierMessage(machineName);
            message.EventData = new [] { data };
            switch (eventType)
            {
            case RaygunPulseSessionEventType.SessionStart:
                data.Type = "session_start";
                break;

            case RaygunPulseSessionEventType.SessionEnd:
                data.Type = "session_end";
                break;
            }
            data.SessionId = _sessionId;
            Send(message);
        }
Пример #12
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);
        }