public string SerializeMetric(string @namespace, string metric, string type, string value, double sample) { if (string.IsNullOrWhiteSpace(metric)) { throw new ArgumentException("metric"); } if (string.IsNullOrWhiteSpace(type)) { throw new ArgumentException("type"); } if (sample < 0 || sample > 1) { throw new ArgumentOutOfRangeException("sample"); } metric = MetricNameBuilder.BuildMetricName(@namespace, metric); var format = sample < 1 ? SampledMetricDatagramFormat : MetricDatagramFormat; var datagram = string.Format(cultureInfo, format, metric, value, type, sample); return(datagram); }
private string GetMetricName(string name) { return(MetricNameBuilder.BuildMetricName(@namespace, name)); }