/// <summary> /// Will stream the given metrics in the specified format, breaking up the metrics into 10 packets at a time, where multiple metrics may /// comprise a single packet. This call is appropriate for infinite IEnumerables. /// </summary> /// <exception cref="ArgumentNullException"> Thrown when the metrics are null. </exception> /// <param name="metrics"> The metrics. </param> public void Stream(IEnumerable<IMetric> metrics) { if (null == metrics) { throw new ArgumentNullException("metrics"); } _messenger.StreamMetrics(metrics.ToStrings(_key, _format)); }
/// <summary> /// Will stream the given metrics in the specified format, breaking up the metrics into 10 packets at a time, where multiple metrics may /// comprise a single packet. This call is appropriate for infinite IEnumerables. /// </summary> /// <exception cref="ArgumentException"> Thrown when the hostNameOrAddress is null or empty OR the key contains invalid characters. </exception> /// <exception cref="ArgumentNullException"> Thrown when the metrics are null. </exception> /// <param name="hostNameOrAddress"> The DNS hostName or IPv4 or IPv6 address of the server. </param> /// <param name="port"> The port. </param> /// <param name="format"> Describes the metric format to use. </param> /// <param name="key"> The optional key to prefix metrics with. </param> /// <param name="metrics"> The metrics. </param> public static void Stream(string hostNameOrAddress, int port, MetricFormat format, string key, IEnumerable<IMetric> metrics) { if (string.IsNullOrEmpty(hostNameOrAddress)) { throw new ArgumentException("cannot be null or empty", "hostNameOrAddress"); } if (!key.IsValidKey()) { throw new ArgumentException("contains invalid characters", "key"); } if (null == metrics) { throw new ArgumentNullException("metrics"); } SendToServer(hostNameOrAddress, port, metrics.ToStrings(key, format), true); }