public string SendData(string method, ConnectionInfo connectionInfo, string serializedData) { try { var uri = GetUri(method, connectionInfo); Log.DebugFormat("Invoking \"{0}\" with : {1}", method, serializedData); AuditLog(Direction.Sent, Source.InstrumentedApp, uri); AuditLog(Direction.Sent, Source.InstrumentedApp, serializedData); var requestPayload = GetRequestPayload(serializedData); var request = BuildRequest(uri, connectionInfo, requestPayload); // Check serializedData length < MaxPayloadSizeInBytes before sending // if > silently drop the payload for now, ideally want to be able split the data // into chunks to send if (requestPayload.Data.Length > _configuration.CollectorMaxPayloadSizeInBytes) { // Log that the payload is being dropped. Log.ErrorFormat("Dropped large payload: size: {0}, max_payload_size_bytes={1}", requestPayload.Data.Length, _configuration.CollectorMaxPayloadSizeInBytes); _agentHealthReporter.ReportSupportabilityPayloadsDroppeDueToMaxPayloadSizeLimit(method); return("{}"); // mimics what is sent by NoOpCollectorWire } var response = SendRequest(request, requestPayload.Data); Log.DebugFormat("Received : {0}", response); AuditLog(Direction.Received, Source.Collector, response); return(response); } catch (WebException ex) { var httpWebResponse = ex.Response as HttpWebResponse; if (httpWebResponse != null) { ThrowExceptionFromHttpWebResponse(serializedData, httpWebResponse); } if (_diagnoseConnectionError) { DiagnoseConnectionError(connectionInfo); } throw; } }