Beispiel #1
0
 public void CanSetGauges()
 {
     _statsClient.Gauge("mygauge", 12d);
     Assert.Equal(12d, _statsClient.GetGaugeValue("mygauge"));
     _statsClient.Gauge("mygauge", 10d);
     _statsClient.Gauge("mygauge", 5d);
     _statsClient.Gauge("mygauge", 4d);
     _statsClient.Gauge("mygauge", 12d);
     _statsClient.Gauge("mygauge", 20d);
     Assert.Equal(20d, _statsClient.GetGaugeValue("mygauge"));
     _statsClient.DisplayStats();
 }
        public async Task CanIncrementCounter()
        {
            var metrics = new InMemoryMetricsClient();

            await metrics.CounterAsync("c1");

            Assert.Equal(1, metrics.GetCount("c1"));

            await metrics.CounterAsync("c1", 5);

            Assert.Equal(6, metrics.GetCount("c1"));

            var counter = metrics.Counters["c1"];

            Assert.True(counter.Rate > 400);

            await metrics.GaugeAsync("g1", 2.534);

            Assert.Equal(2.534, metrics.GetGaugeValue("g1"));

            await metrics.TimerAsync("t1", 50788);

            var stats = metrics.GetMetricStats();

            Assert.Equal(1, stats.Timings.Count);

            metrics.DisplayStats(_writer);
        }
Beispiel #3
0
        public async Task CanSetGaugesAsync()
        {
            await _metricsClient.GaugeAsync("mygauge", 12d);

            Assert.Equal(12d, _metricsClient.GetGaugeValue("mygauge"));
            await _metricsClient.GaugeAsync("mygauge", 10d);

            await _metricsClient.GaugeAsync("mygauge", 5d);

            await _metricsClient.GaugeAsync("mygauge", 4d);

            await _metricsClient.GaugeAsync("mygauge", 12d);

            await _metricsClient.GaugeAsync("mygauge", 20d);

            Assert.Equal(20d, _metricsClient.GetGaugeValue("mygauge"));
            _metricsClient.DisplayStats();
        }