Esempio n. 1
0
 public HistogramSpec(
     string name,
     string help,
     string[] labels,
     HistogramBuckets buckets) : base(name, help, labels)
 {
     Buckets = buckets;
 }
Esempio n. 2
0
        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}");
        }
Esempio n. 3
0
        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
            });
        }
Esempio n. 4
0
 public void AddHistogram(string name, HistogramBuckets buckets, string help = null, string[] labels = null)
 {
     Histograms.Add(new HistogramSpec(name, help, labels, buckets));
 }