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(); }
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); }
public HystrixTimerTest(ITestOutputHelper output) { _ = HystrixTimer.GetInstance(); HystrixTimer.Reset(); HystrixPlugins.Reset(); this.output = output; }
public static void Reset(TimeSpan timeout) { HystrixThreadPoolFactory.Shutdown(timeout); HystrixCommandMetrics.Reset(); //HystrixCollapser.Reset(); HystrixCircuitBreakerFactory.Reset(); HystrixPlugins.Reset(); //HystrixPropertiesFactory.reset(); //currentCommand.set(new LinkedList<HystrixCommandKey>()); }
public HystrixTestBase() { HystrixCommandMetrics.Reset(); HystrixThreadPoolMetrics.Reset(); HystrixCollapserMetrics.Reset(); // clear collapsers RequestCollapserFactory.Reset(); // clear circuit breakers HystrixCircuitBreakerFactory.Reset(); HystrixPlugins.Reset(); HystrixOptionsFactory.Reset(); }
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(); }
public void Dispose() { HystrixPlugins.Reset(); }