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); }
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)); }
internal Metrics(WithMetricsAttribute attribute) { this.attribute = attribute; Reset(); }