コード例 #1
0
        public void Before()
        {
            context = HystrixRequestContext.InitializeContext();

            HystrixCommandMetrics.Reset();
            HystrixThreadPoolMetrics.Reset();
            HystrixCollapserMetrics.Reset();

            // clear collapsers
            RequestCollapserFactory.Reset();

            // clear circuit breakers
            HystrixCircuitBreakerFactory.Reset();
            HystrixPlugins.Reset();
            HystrixOptionsFactory.Reset();

            // clear up all streams
            CumulativeCollapserEventCounterStream.Reset();
            CumulativeCommandEventCounterStream.Reset();
            CumulativeThreadPoolEventCounterStream.Reset();
            RollingCollapserBatchSizeDistributionStream.Reset();
            RollingCollapserEventCounterStream.Reset();
            RollingCommandEventCounterStream.Reset();
            RollingCommandLatencyDistributionStream.Reset();
            RollingCommandMaxConcurrencyStream.Reset();
            RollingCommandUserLatencyDistributionStream.Reset();
            RollingThreadPoolEventCounterStream.Reset();
            RollingThreadPoolMaxConcurrencyStream.Reset();
        }
コード例 #2
0
        public void TestMetricsPublisherReset()
        {
            // precondition: HystrixMetricsPublisherFactory class is not loaded. Calling HystrixPlugins.reset() here should be good enough to run this with other tests.

            // set first custom publisher
            IHystrixCommandKey key = HystrixCommandKeyDefault.AsKey("key");
            IHystrixMetricsPublisherCommand firstCommand   = new HystrixMetricsPublisherCommandDefault(key, null, null, null, null);
            HystrixMetricsPublisher         firstPublisher = new CustomPublisher(firstCommand);

            HystrixPlugins.RegisterMetricsPublisher(firstPublisher);

            // ensure that first custom publisher is used
            IHystrixMetricsPublisherCommand cmd = HystrixMetricsPublisherFactory.CreateOrRetrievePublisherForCommand(key, null, null, null, null);

            Assert.True(firstCommand == cmd);

            // reset, then change to second custom publisher
            HystrixPlugins.Reset();
            IHystrixMetricsPublisherCommand secondCommand   = new HystrixMetricsPublisherCommandDefault(key, null, null, null, null);
            HystrixMetricsPublisher         secondPublisher = new CustomPublisher(secondCommand);

            HystrixPlugins.RegisterMetricsPublisher(secondPublisher);

            // ensure that second custom publisher is used
            cmd = HystrixMetricsPublisherFactory.CreateOrRetrievePublisherForCommand(key, null, null, null, null);
            Assert.True(firstCommand != cmd);
            Assert.True(secondCommand == cmd);
        }
コード例 #3
0
 public HystrixTimerTest(ITestOutputHelper output)
 {
     _ = HystrixTimer.GetInstance();
     HystrixTimer.Reset();
     HystrixPlugins.Reset();
     this.output = output;
 }
コード例 #4
0
ファイル: Hystrix.cs プロジェクト: zhaoqinglong/Hystrix.NET
        public static void Reset(TimeSpan timeout)
        {
            HystrixThreadPoolFactory.Shutdown(timeout);
            HystrixCommandMetrics.Reset();
            //HystrixCollapser.Reset();
            HystrixCircuitBreakerFactory.Reset();
            HystrixPlugins.Reset();

            //HystrixPropertiesFactory.reset();
            //currentCommand.set(new LinkedList<HystrixCommandKey>());
        }
コード例 #5
0
 public HystrixTestBase()
 {
     HystrixCommandMetrics.Reset();
     HystrixThreadPoolMetrics.Reset();
     HystrixCollapserMetrics.Reset();
     // clear collapsers
     RequestCollapserFactory.Reset();
     // clear circuit breakers
     HystrixCircuitBreakerFactory.Reset();
     HystrixPlugins.Reset();
     HystrixOptionsFactory.Reset();
 }
コード例 #6
0
        public HystrixTestBase()
        {
            this.context = HystrixRequestContext.InitializeContext();

            HystrixCommandMetrics.Reset();
            HystrixThreadPoolMetrics.Reset();
            HystrixCollapserMetrics.Reset();
            // clear collapsers
            RequestCollapserFactory.Reset();
            // clear circuit breakers
            HystrixCircuitBreakerFactory.Reset();
            HystrixPlugins.Reset();
            HystrixOptionsFactory.Reset();
        }
コード例 #7
0
 public void Dispose()
 {
     HystrixPlugins.Reset();
 }