← Projects

Project · Go · MIT

brownout active

Go HTTP middleware for shedding some or all traffic to selected routes at runtime, from Go, a JSON admin API or a watched file.

shell
go get github.com/rossedman/brownout

brownout is plain net/http middleware that lets you turn off, or partly turn off, chosen routes while the server is running. Add a rule and the very next request sees it. Remove it when the incident is over. No restart and no redeploy.

  • Partial brownouts. Let a percentage of traffic through instead of all or nothing.
  • Method filters. Shed only writes to make an API read-only.
  • Rules that expire, so a forgotten brownout doesn’t stay on forever.
  • Three ways to change rules: the Go API, a JSON admin API, or a watched JSON file.
  • No dependencies outside the standard library.

The docs site has an interactive playground for trying rules against paths.

Writing about brownout

  1. Introducing brownout: Turn Off Go Endpoints Without a Deploy brownout is a small Go middleware library for shedding some or all traffic to selected HTTP routes at runtime, from Go, a JSON admin API or a watched file. 8 min read