hystrix-go icon indicating copy to clipboard operation
hystrix-go copied to clipboard

Add NoOpCircuitBreaker

Open wangfenjin opened this issue 10 years ago • 1 comments

Change-Id: I81cff81983ff099217825466b24a72bf63c37665

In this PR, I try to add a NoOpCircuitBreaker same as here HystrixCircuitBreaker.java. It enables user to disable CircuitBreaker but still use the metrics and Dashboard feature, which is needed for new users like me.

The general logic is as follows:

  1. Add a CircuitBreakerDisabled setting so user can disable circuit. Default value is false for backward compatibility.
  2. If user config CircuitBreakerDisabled as true, GetCircuit will return a NoOpCircuitBreaker with a noOpExecutorPool.

More infos can be find in comments.

The test coverage is 93.2% and I had test the logic in real code logic. The benchmark of original and NoOp circuit is nearly the same, benchmark of noOpExecutorPool is worse than original executorPool, I think it may because I always return a new buffered chan with 1 element in it.

Please help review the code, looking forward to hear advises from you. Thanks!

wangfenjin avatar Feb 27 '16 14:02 wangfenjin

@afex Please help take a look at this PR? Thanks.

wangfenjin avatar Mar 01 '16 14:03 wangfenjin