public static JsonHistogram FromHistogram(MetricValueSource<HistogramValue> histogram)
        {
            return new JsonHistogram
            {
                Name = histogram.Name,

                Count = histogram.Value.Count,
                LastValue = histogram.Value.LastValue,
                LastUserValue = histogram.Value.LastUserValue,

                Max = histogram.Value.Max,
                MaxUserValue = histogram.Value.MaxUserValue,

                Mean = histogram.Value.Mean,

                Min = histogram.Value.Min,
                MinUserValue = histogram.Value.MinUserValue,

                StdDev = histogram.Value.StdDev,

                Median = histogram.Value.Median,
                Percentile75 = histogram.Value.Percentile75,
                Percentile95 = histogram.Value.Percentile95,
                Percentile98 = histogram.Value.Percentile98,
                Percentile99 = histogram.Value.Percentile99,
                Percentile999 = histogram.Value.Percentile999,

                SampleSize = histogram.Value.SampleSize,

                Unit = histogram.Unit.Name,
                Tags = histogram.Tags
            };
        }
Exemple #2
0
 public static JsonGauge FromGauge(MetricValueSource<double> gauge)
 {
     return new JsonGauge
     {
         Name = gauge.Name,
         Value = gauge.Value,
         Unit = gauge.Unit.Name,
         Tags = gauge.Tags
     };
 }
 public static JsonCounter FromCounter(MetricValueSource<CounterValue> counter)
 {
     return new JsonCounter
     {
         Name = counter.Name,
         Count = counter.Value.Count,
         Unit = counter.Unit.Name,
         Items = counter.Value.Items.Select(i => new SetItem { Item = i.Item, Count = i.Count, Percent = i.Percent }).ToArray(),
         Tags = counter.Tags
     };
 }
Exemple #4
0
 protected virtual string FormatMetricName <T>(string context, MetricValueSource <T> metric)
 {
     return(string.Concat("[", context, "] ", metric.Name));
 }
 public void ReportMetric <T>(string context, MetricValueSource <T> valueSource)
 {
 }
Exemple #6
0
 protected override string FormatMetricName <T>(string context, MetricValueSource <T> metric)
 {
     return(string.Concat(context, ".", GraphiteName(metric.Name)));
 }
        public static string Hummanize <T>(this MetricValueSource <T> valueSource)
        {
            FormattableString metricValueSourceString = $"{valueSource}";

            return(metricValueSourceString.ToString(new HumanizeMetricValueFormatProvider <T>()));
        }
 public static string HumanzizeName <T>(this MetricValueSource <T> valueSource, string context)
 {
     return($"\t[{context}] {valueSource.Name}");
 }
Exemple #9
0
 public void ReportMetric <T>(string context, MetricValueSource <T> valueSource)
 {
     WriteStartMetricType <T>(context);
     _buffer.WriteMetricName(valueSource);
     _buffer.WriteMetricValue(valueSource);
 }
Exemple #10
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="context"></param>
 /// <param name="metric"></param>
 /// <typeparam name="T"></typeparam>
 /// <returns></returns>
 protected override string FormatMetricName <T>(string context, MetricValueSource <T> metric)
 {
     return(FormatName(metric.Name));
 }
Exemple #11
0
        public void ReportMetric <T>(string name, MetricValueSource <T> valueSource)
        {
            WriteLine(valueSource.HumanzizeName(name));

            WriteLine(valueSource.Hummanize());
        }