예제 #1
0
 private static void Generate(out Holder holder, WithMetricsAttribute ma)
 {
     holder = new Holder { Logger = new TesterLogger() };
     holder.Interceptor = new MetricsInterceptor { DefaultMarkerInstance = ma, Logger = holder.Logger };
     holder.Tester = (Tester)Factory.CreateClassProxy(typeof(Tester), holder.Interceptor);
 }
예제 #2
0
        public void Minimum_threshold_can_filter_out_noise()
        {
            var attribute = new WithMetricsAttribute
            {
                IsVarianceEnabled = true,
                StandardDeviationThreshold = 1, // override default
                MinimumThreshold = 1000
            };
            Metrics metrics = new Metrics(attribute);
            metrics.Increment(TimeSpan.FromSeconds(10));
            metrics.Increment(TimeSpan.FromSeconds(10));
            Assert.That(metrics.Increment(TimeSpan.FromSeconds(0.1)), Is.EqualTo(MetricsUpdateEventReason.None));

            attribute.MinimumThreshold = 0;
            Assert.That(metrics.Increment(TimeSpan.FromSeconds(0.1)), Is.EqualTo(MetricsUpdateEventReason.StandardDeviationThreshold));
        }
예제 #3
0
 internal Metrics(WithMetricsAttribute attribute)
 {
     this.attribute = attribute;
     Reset();
 }