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 }; }
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 }; }
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) { }
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}"); }
public void ReportMetric <T>(string context, MetricValueSource <T> valueSource) { WriteStartMetricType <T>(context); _buffer.WriteMetricName(valueSource); _buffer.WriteMetricValue(valueSource); }
/// <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)); }
public void ReportMetric <T>(string name, MetricValueSource <T> valueSource) { WriteLine(valueSource.HumanzizeName(name)); WriteLine(valueSource.Hummanize()); }