public void histogram_tests() { Histogram histogram = Metrics.CreateHistogram("hist1", "help", new [] { 1.0, 2.0, 3.0 }); histogram.Observe(1.5); histogram.Observe(2.5); histogram.Observe(1); histogram.Observe(2.4); histogram.Observe(2.1); histogram.Observe(0.4); histogram.Observe(1.4); histogram.Observe(1.5); histogram.Observe(3.9); var metric = histogram.Collect().metric[0]; Assert.NotNull(metric.histogram); Assert.Equal(9ul, metric.histogram.sample_count); Assert.Equal(16.7, metric.histogram.sample_sum); Assert.Equal(4, metric.histogram.bucket.Count); Assert.Equal(2ul, metric.histogram.bucket[0].cumulative_count); Assert.Equal(5ul, metric.histogram.bucket[1].cumulative_count); Assert.Equal(8ul, metric.histogram.bucket[2].cumulative_count); Assert.Equal(9ul, metric.histogram.bucket[3].cumulative_count); }
public Histogram(string name, string help, HistogramConfiguration histogramConfiguration = null) { _histogram = Pro.Metrics.CreateHistogram(name, help, histogramConfiguration?.Configuration); }