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); }
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); }
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); } } }
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); }
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((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.IsNullOrEmpty(User) ? new RaygunIdentifierMessage(User) : BuildRaygunIdentifierMessage(null)); 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); }
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); }