public HistogramSpec( string name, string help, string[] labels, HistogramBuckets buckets) : base(name, help, labels) { Buckets = buckets; }
internal void RegisterHistogram(string name, string help, string[] labels, HistogramBuckets buckets) { var key = BuildKey(name); var config = BuildHistogramConfig(buckets, labels); var histogram = Prometheus.Metrics.CreateHistogram(key, help, config); _histograms.Add(key, histogram); Logger.Debug($"Registered histogram metric {key}"); }
static HistogramConfiguration BuildHistogramConfig(HistogramBuckets buckets, string[] labels) { var promBuckets = buckets.Kind == HistogramBucketKind.Exponential ? Histogram.ExponentialBuckets(buckets.Start, buckets.Inc, (int)buckets.Count) : Histogram.LinearBuckets(buckets.Start, buckets.Inc, (int)buckets.Count); return(new HistogramConfiguration { LabelNames = labels, Buckets = promBuckets }); }
public void AddHistogram(string name, HistogramBuckets buckets, string help = null, string[] labels = null) { Histograms.Add(new HistogramSpec(name, help, labels, buckets)); }