public void Increment_AfterPeriodExceeded_ResetsBeforeIncrementing()
        {
            const long periodMillis = 1000;
            var clock = new ManualTestClock();
            var bucket = new ResettingNumbersBucket(clock, new TransientConfigurableValue<long>(periodMillis));

            bucket.Increment(CounterMetric.CommandSuccess);

            clock.AddMilliseconds(periodMillis + 1);
            Assert.Equal(1, bucket.GetCount(CounterMetric.CommandSuccess));

            bucket.Increment(CounterMetric.CommandSuccess); // Should reset and then count one.
            Assert.Equal(1, bucket.GetCount(CounterMetric.CommandSuccess)); // Should be 1, not 2.
        }
示例#2
0
 public void MarkCommandSuccess()
 {
     _stats.Event(StatsPrefix + " Mark", CounterMetric.CommandSuccess.ToString(), null);
     _resettingNumbersBucket.Increment(CounterMetric.CommandSuccess);
 }
示例#3
0
 public void MarkCommandSuccess()
 {
     _resettingNumbersBucket.Increment(CounterMetric.CommandSuccess);
 }