Circuitbox 2.0 is tested against Ruby 2.6 through 3.2. Since ruby 2.6 and 2.7 are EOL it's likely we'll drop support for those versions in future releases.
- The
timeout_seconds
option when initializing a circuit has been removed.- Circuitbox does not wrap the block to run with Ruby's
Timeout
anymore.- If you would like to use Ruby's
Timeout
you would need to do this yourself.
- If you would like to use Ruby's
- Circuitbox does not wrap the block to run with Ruby's
- A
CircuitBreaker
'srun
method has been changed and therun!
method has been removed.- Calling
run
is now like callingrun!
in circuitbox 1.x. - If you were using
run
in circuitbox 1.x you can callrun(exception: false)
to have the same behavior.
- Calling
- The
logger
option when initializing a circuit has been removed.- If you would like to use a logger you can either
- If using the
ActiveSupport
notifier subscribe to it's notifications to add your own logger - Implement your own notifier using the same interface, see the
ActiveSupport
orNull
notifier.
- If using the
- If you would like to use a logger you can either
- The
exceptions
option when initializing a circuit must be an array. - The
exceptions
option when initializing a circuit does not default to[Timeout::Error]
when the array is empty. - The
cache
option when initializing a circuit as been renamed tocircuit_store
. - A circuits defaults sleep_window has changed from 300 seconds to 90 seconds.
- The
partition
option when running a circuit has been removed. - attr_accessor's on
CircuitBreaker
have been changed to attr_reader, or in some cases removed.partition
has been removedlogger
has been removed (see above about logger option)time_class
has been added
- The class level
reset
method onCircuitbox
has been removed.- If you need to reset circuits before/after running a test you can reconfigure circuitbox
Circuitbox.configure do |config| # Reset persisted state in the memory store so it doesn't leak between tests # if using a store through moneta and want to reset it between tests you may need to do something else config.default_circuit_store = Circuitbox::MemoryStore.new end
- If you need to reset circuits before/after running a test you can reconfigure circuitbox
- The class level
reset
method onCircuitbox::CircuitBreaker
has been removed.- This method would call
reset
onCircuitbox
, see above aboutCircuitbox.reset
.
- This method would call
Circuitbox.circuit
does not parse a host name out of a uri and use that as the circuit's service_name.- If you rely on this functionality parse the host from the uri before calling
Circuitbox.circuit
- If you rely on this functionality parse the host from the uri before calling
- Accessing/creating a circuit through
Circuitbox[:circuit_identifier]
has been removed. - Circuitbox's notifications sent through
ActiveSupport::Notifications
have had their names changed.circuit_open
changes toopen.circuitbox
circuit_close
changes toclose.circuitbox
circuit_success
changes tosuccess.circuitbox
circuit_failure
changes tofailure.circuitbox
circuit_skipped
changes toskipped.circuitbox
circuit_gauge
removedcircuit_warning
changes towarning.circuitbox
- add
run.circuitbox
to track runtime of the block the circuit is running
- Circuit's don't emit their error rate, success counts, failure counts through
ActiveSupport::Notifications
anymore.- The methods
error_rate
,success_count
,failure_count
on a circuit instance can be used to obtain this information.
- The methods
- During circuit initialization if
sleep_window
is less thantime_window
it is not set totime_window
.- Circuitbox warns about, and only checks this during circuit initialization
- Circuitbox's default circuit store has changed from
Moneta
's memory store toCircuitbox::MemoryStore
.Circuitbox::MemoryStore
periodically removes expired keys from the store, allowing Ruby to reclaim memory- When
Circuitbox::MemoryStore
is used a circuits time class isCircuitbox::TimeHelper::Monotonic
- If using
Moneta
as a circuit store, only adapters that support bulk read functionality are supported.