View definition

package cbreaker

Defined in github.com/vulcand/oxy/cbreaker

Description

Circuit breakers start in the Standby state first, observing responses and watching location metrics.

Once the Circuit breaker condition is met, it enters the "Tripped" state, where it activates fallback scenario for all requests during the FallbackDuration time period and reset the stats for the location.

After FallbackDuration time period passes, Circuit breaker enters "Recovering" state, during that state it will start passing some traffic back to the endpoints, increasing the amount of passed requests using linear function:

allowedRequestsRatio = 0.5 * (Now() - StartRecovery())/RecoveryDuration

Two scenarios are possible in the "Recovering" state: 1. Condition matches again, this will reset the state to "Tripped" and reset the timer. 2. Condition does not match, circuit breaker enters "Standby" state

It is possible to define actions (e.g. webhooks) of transitions between states:

* OnTripped action is called on transition (Standby -> Tripped) * OnStandby action is called on transition (Recovering -> Standby)

cbreaker is referenced in 2 repositories

github.com/vulcand/oxy github.com/containous/traefik