コード例 #1
0
        public void ShouldYieldNoExecutedTasksOnStartup()
        {
            // given
            var instances = HystrixThreadPoolMetrics.GetInstances();

            // then
            Assert.Equal(0, instances.Count);
        }
        public void ShouldReturnOneExecutedTask()
        {
            // given
            var stream = RollingThreadPoolEventCounterStream.GetInstance(tpKey, 10, 100);

            stream.StartCachingStreamValuesIfUnstarted();

            var cmd = new NoOpHystrixCommand(output);

            cmd.Execute();
            Time.Wait(125);

            ICollection <HystrixThreadPoolMetrics> instances = HystrixThreadPoolMetrics.GetInstances();

            // then
            Assert.Equal(1, instances.Count);
            HystrixThreadPoolMetrics metrics = instances.First();

            Assert.Equal(1, metrics.RollingCountThreadsExecuted);
        }
コード例 #3
0
        public async Task ShouldReturnOneExecutedTask()
        {
            // given
            var stream = RollingThreadPoolEventCounterStream.GetInstance(TpKey, 10, 100);

            stream.StartCachingStreamValuesIfUnstarted();

            var cmd = new NoOpHystrixCommand(output);
            await cmd.ExecuteAsync();

            Time.Wait(250);

            var instances = HystrixThreadPoolMetrics.GetInstances();

            // then
            output.WriteLine($"Instance count: {instances.Count}");
            Assert.Equal(1, instances.Count);
            var metrics = instances.First();

            output.WriteLine($"RollingCountThreadsExecuted: {metrics.RollingCountThreadsExecuted}");
            Assert.Equal(1, metrics.RollingCountThreadsExecuted);
        }
コード例 #4
0
 private HystrixDashboardStream(int delayInMs)
 {
     this.delayInMs    = delayInMs;
     this.singleSource = Observable.Interval(TimeSpan.FromMilliseconds(delayInMs))
                         .Map((timestamp) => { return(new DashboardData(HystrixCommandMetrics.GetInstances(), HystrixThreadPoolMetrics.GetInstances(), HystrixCollapserMetrics.GetInstances())); })
                         .OnSubscribe(() => { isSourceCurrentlySubscribed.Value = true; })
                         .OnDispose(() => { isSourceCurrentlySubscribed.Value = false; })
                         .Publish().RefCount();
 }