예제 #1
0
        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
            };
        }
예제 #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
     };
 }
예제 #3
0
 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
     };
 }
예제 #4
0
 protected virtual string FormatMetricName <T>(string context, MetricValueSource <T> metric)
 {
     return(string.Concat("[", context, "] ", metric.Name));
 }
예제 #5
0
 public void ReportMetric <T>(string context, MetricValueSource <T> valueSource)
 {
 }
예제 #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}");
 }
예제 #9
0
 public void ReportMetric <T>(string context, MetricValueSource <T> valueSource)
 {
     WriteStartMetricType <T>(context);
     _buffer.WriteMetricName(valueSource);
     _buffer.WriteMetricValue(valueSource);
 }
예제 #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));
 }
예제 #11
0
        public void ReportMetric <T>(string name, MetricValueSource <T> valueSource)
        {
            WriteLine(valueSource.HumanzizeName(name));

            WriteLine(valueSource.Hummanize());
        }