Patrol documentation
Patrol is a Go library that collects the events your service reports and delivers them in batches. One Producer buffers what your code sends. A set of flushers delivers each batch to Slack, Discord, Twilio, email over SMTP, a SQL table, or over HTTP to a patrol Server running somewhere else. Flushers run at the same time and independently, so one that fails or stalls never holds back the others.
It is one package, github.com/kataras/patrol, with no sub-packages. Every constructor, option struct and flusher is under patrol.
Start here
Section titled “Start here”- Install adds the module to your project.
- Your first event sends one error to Slack and reads the result.
- Producer and batching explains when a batch flushes and what the options do.
Pick a destination
Section titled “Pick a destination”One page each, all the same shape: what it sends, the constructor, the option keys for a config file, what Test checks, a worked example and the gotchas.
- Slack, one Block Kit message per channel and project, with file uploads and mentions
- Discord, one bot message per channel and project
- Twilio, one SMS or WhatsApp message per project
- Email, one HTML email per project over SMTP
- SQL, rows in a
patrol_eventstable - HTTP client, the batch as JSON to a patrol
Server
Nothing here is exclusive. A Producer takes as many flushers as you pass it, and your own type is one of them the moment it has a FlushEvents method.
Run the server half
Section titled “Run the server half”A patrol Server is an http.Handler that receives those batches and delivers them to its own flushers. Put the credentials in one place, point every service at it, and read Run your own Server. Patrol Cloud is that server operated for you, with storage and a console on top.
Reference
Section titled “Reference”The configuration file keys table is generated from the library’s own exported API, so the key names on it are the ones a YAML, JSON or TOML file needs. Links and examples points at pkg.go.dev, the source and the runnable programs in _examples.