/// <summary> /// Method to serialize MonitoringAPICallEvent CSM event to json. /// </summary> private static bool CreateUDPMessage(MonitoringAPICallEvent monitoringAPICallEvent, out string response) { JsonWriter jw = new JsonWriter(); jw.WriteObjectStart(); jw = CreateUDPMessage(monitoringAPICallEvent, jw); jw.WritePropertyName("Latency"); jw.Write(monitoringAPICallEvent.Latency); jw.WritePropertyName("AttemptCount"); jw.Write(monitoringAPICallEvent.AttemptCount); jw.WritePropertyName("MaxRetriesExceeded"); int maxRetriesValue = 0; if (monitoringAPICallEvent.IsLastExceptionRetryable) { maxRetriesValue = 1; } jw.Write(maxRetriesValue); jw.WriteObjectEnd(); response = jw.ToString(); return(ASCIIEncoding.Unicode.GetByteCount(response) <= (8 * 1024)); }
/// <summary> /// Method to serialize MonitoringAPICallEvent CSM event to json. /// </summary> private static bool CreateUDPMessage(MonitoringAPICallEvent monitoringAPICallEvent, out string response) { JsonWriter jw = new JsonWriter(); jw.WriteObjectStart(); jw = CreateUDPMessage(monitoringAPICallEvent, jw); jw.WritePropertyName("Latency"); jw.Write(monitoringAPICallEvent.Latency); jw.WritePropertyName("AttemptCount"); jw.Write(monitoringAPICallEvent.AttemptCount); jw.WriteObjectEnd(); response = jw.ToString(); return(ASCIIEncoding.Unicode.GetByteCount(response) <= (8 * 1024)); }