コード例 #1
0
 public void SingleWithSharedLabels()
 {
     for (var i = 0; i < _metricsPerIteration; i++)
     {
         OurMetricFactory.CreateHistogram("testhistogram", HelpText, false, null, _labelNames);
     }
 }
コード例 #2
0
 public void SingleWithLabels_Array()
 {
     for (var i = 0; i < _metricsPerIteration; i++)
     {
         OurMetricFactory.CreateHistogram("testhistogram", HelpText, false, null, "foo", "bar", "baz");
     }
 }
コード例 #3
0
 public void SingleWithLabels_Tuple()
 {
     for (var i = 0; i < _metricsPerIteration; i++)
     {
         OurMetricFactory.CreateHistogram("testhistogram", HelpText, ("foo", "bar", "baz"));
     }
 }
コード例 #4
0
 public void ManyWithLabels_Tuple()
 {
     for (var i = 0; i < _metricsPerIteration; i++)
     {
         OurMetricFactory.CreateHistogram(_metricNames[i], HelpText, ("foo", "bar", "baz"));
     }
 }
コード例 #5
0
 public void Single()
 {
     for (var i = 0; i < _metricsPerIteration; i++)
     {
         OurMetricFactory.CreateHistogram("testhistogram", HelpText, ValueTuple.Create());
     }
 }
コード例 #6
0
 public void Many()
 {
     for (var i = 0; i < _metricsPerIteration; i++)
     {
         OurMetricFactory.CreateHistogram(_metricNames[i], HelpText, ValueTuple.Create());
     }
 }
コード例 #7
0
 public void ManyWithLabels_Array()
 {
     for (var i = 0; i < _metricsPerIteration; i++)
     {
         OurMetricFactory.CreateHistogram(_metricNames[i], HelpText, false, null, "foo", "bar", "baz");
     }
 }
 public void WithLabels_Tuple()
 {
     for (var i = 0; i < _metricsCount; i++)
     {
         var histogram = OurMetricFactory.CreateHistogram(_metricNames[i], HelpText, ("foo", "bar", "baz"));
         histogram.Observe(i / 100d);
     }
 }
 public void NoLabels()
 {
     for (var i = 0; i < _metricsCount; i++)
     {
         var histogram = OurMetricFactory.CreateHistogram(_metricNames[i], HelpText);
         histogram.Observe(i / 100d);
     }
 }
コード例 #10
0
        public void Setup()
        {
            _histogramDefaultBuckets = OurMetricFactory.CreateHistogram("testhistogram1", HelpText);
            _histogramManyBuckets    = OurMetricFactory.CreateHistogram("testhistogram2", HelpText, false, _bucketsMany);

            _theirHistogramDefaultBuckets = TheirMetricFactory.CreateHistogram("testhistogram1", HelpText);
            _theirHistogramManyBuckets    = TheirMetricFactory.CreateHistogram("testhistogram2", HelpText, new Their.Prometheus.HistogramConfiguration()
            {
                Buckets = _bucketsMany
            });
        }
コード例 #11
0
 public void WithLabelsAndSamples_Array()
 {
     for (var i = 0; i < _metricsCount; i++)
     {
         var histogram = OurMetricFactory.CreateHistogram(_metricNames[i], HelpText, "foo", "bar", "baz");
         for (var j = 0; j < _samplesCount; j++)
         {
             histogram.WithLabels(_labelValues[j][0], _labelValues[j][1], _labelValues[j][2]).Observe(i / 100d);
         }
     }
 }
コード例 #12
0
        public HistogramCollectingBenchmarks()
        {
            var labelNames    = GenerateLabelNames(_labelsCount).ToArray();
            var labelVariants = GenerateLabelValues(_variantsCount, _labelsCount);
            var rnd           = new Random();

            foreach (var metric in GenerateMetricNames(_metricsCount))
            {
                var ourMetric   = OurMetricFactory.CreateHistogram(metric, HelpText, labelNames);
                var theirMetric = TheirMetricFactory.CreateHistogram(metric, HelpText, labelNames);

                foreach (var labels in labelVariants)
                {
                    for (var i = 0; i < _observationsCount; i++)
                    {
                        var val = rnd.Next(10);
                        ourMetric.WithLabels(labels).Observe(val);
                        theirMetric.WithLabels(labels).Observe(val);
                    }
                }
            }
        }