Examples
HTTP Server with Backpressure
Section titled “HTTP Server with Backpressure”See examples/http_server for a complete HTTP server that:
- Processes background jobs via the pool
- Returns 503 when overloaded
- Exposes metrics endpoint
- Handles graceful shutdown
cd examples/http_servergo run main.goBatch Processing
Section titled “Batch Processing”See examples/batch_processor for processing large batches with:
- Adaptive worker scaling
- Real-time progress tracking
- Throughput metrics
cd examples/batch_processorgo run main.goObservability with Prometheus and Grafana
Section titled “Observability with Prometheus and Grafana”See examples/observability for two pools exporting metrics through promrecorder, with a Prometheus and Grafana stack and a provisioned dashboard:
- Bursty synthetic load with retries,
Permanenterrors andRetryAfterhints - Per-kind throughput, failures by status, latency and queue wait
- Rejections from request-scoped and best-effort work on a second, smaller pool
# From the repo root: start the app (metrics on :2112/metrics)make run-observability
# Then start Prometheus (:9090) and Grafana (:3000)cd examples/observability && docker compose up