Example #1
0
        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);
        }
Example #2
0
 private string GetMetricName(string name)
 {
     return(MetricNameBuilder.BuildMetricName(@namespace, name));
 }