examples/

directory
v1.20.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2026 License: MIT

README

chaotic examples

Runnable, tested scenarios. Each directory has a main.go (go run .), a main_test.go (go test ./...), and a README.md. Per-symbol godoc examples live next to each package (see the Example* functions on pkg.go.dev).

Scenario Demonstrates Adapter
retry-http a retry loop recovers from a transient injected failure adapter/http
circuit-breaker a breaker opens after repeated injected failures adapter/http
db-conn-pool the pool evicts a poisoned conn (ConnDropErrBadConn) adapter/sql
grpc-stream-reconnect a stream client reconnects after an injected Unavailable adapter/grpc
chaos-point an explicit chaos.Point guards a post-commit hook chaos (v3)
prod-safety-rails failure budget + caps + guard + kill switch bound the blast radius engine
pgx-pool pool-level chaos on a pgx pool (integration-gated) adapter/pgx

grpc-stream-reconnect, chaos-point, and pgx-pool are added by their respective plans; the rest ship with the v3 plan.

Directories

Path Synopsis
Command chaos-point demonstrates an explicit injection point guarding a post-commit hook.
Command chaos-point demonstrates an explicit injection point guarding a post-commit hook.
Command circuit-breaker shows a circuit breaker opening after chaos injects repeated failures, after which calls short-circuit instead of calling the failing dependency.
Command circuit-breaker shows a circuit breaker opening after chaos injects repeated failures, after which calls short-circuit instead of calling the failing dependency.
Command db-conn-pool shows database/sql discarding a poisoned connection and transparently retrying on a fresh one when chaos injects a connection drop.
Command db-conn-pool shows database/sql discarding a poisoned connection and transparently retrying on a fresh one when chaos injects a connection drop.
Command prod-safety-rails shows the production bounds that keep chaos from becoming the outage: a failure budget, a max-concurrent cap, a production guard, and a kill switch.
Command prod-safety-rails shows the production bounds that keep chaos from becoming the outage: a failure budget, a max-concurrent cap, a production guard, and a kill switch.
Command retry-http demonstrates a retry loop recovering from a transient fault injected into an http.Client's transport.
Command retry-http demonstrates a retry loop recovering from a transient fault injected into an http.Client's transport.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL