private void SendLine(GraphiteLine line) { byte[] data = Encoding.ASCII.GetBytes(line.ToString()); try { _client.Send(data, data.Length); _systemMetrics.LogCount("backends.graphite.lines"); _systemMetrics.LogCount("backends.graphite.bytes", data.Length); } catch (SocketException ex) { _log.Error("Failed to send packet to Graphite: " + ex.SocketErrorCode); } }
public DataflowMessageStatus OfferMessage(DataflowMessageHeader messageHeader, GraphiteLine messageValue, ISourceBlock <GraphiteLine> source, bool consumeToAccept) { byte[] data = Encoding.ASCII.GetBytes(messageValue.ToString()); try { _client.Send(data, data.Length); _systemMetrics.LogCount("backends.graphite.lines"); _systemMetrics.LogCount("backends.graphite.bytes", data.Length); } catch (SocketException ex) { _log.Error("Failed to send packet to Graphite: " + ex.SocketErrorCode.ToString()); } return(DataflowMessageStatus.Accepted); }