1mb

build with

autobreaker

Go circuit breaker, count or rate

get autobreaker docs

Execute wraps a call and counts its result. With AdaptiveThreshold: true, the breaker trips when more than 5% of requests fail. The API follows the sony/gobreaker v1 shape. No dependencies, and Execute allocates nothing, closed, open or half-open.

The rate counts over a fixed window set by Interval. With no Interval, the counts accumulate until the state changes.

why it exists

Ten failures can be noise or an outage. The difference is how many requests came with them. autobreaker can trip on the share of requests that fail. It was built to run on the same threshold in every environment: at 100 requests a window or 1,000, the 5% holds.

what it taught

A failure rate needs a sample before it means anything. With the rate on, nothing trips until a window holds 20 requests, even if every one fails. By default the rate is off, and the breaker trips on the sixth failure in a row.

get autobreaker

related

all work