https://github.com/metaswitch/vigil
Software watchdog library for Rust services
https://github.com/metaswitch/vigil
Last synced: 5 months ago
JSON representation
Software watchdog library for Rust services
- Host: GitHub
- URL: https://github.com/metaswitch/vigil
- Owner: Metaswitch
- License: other
- Created: 2018-05-10T18:01:12.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-19T19:15:50.000Z (about 3 years ago)
- Last Synced: 2024-12-13T12:48:07.395Z (over 1 year ago)
- Language: Rust
- Size: 26.4 KB
- Stars: 10
- Watchers: 5
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING
- License: LICENSE-APACHE-2.0
Awesome Lists containing this project
README
# Vigil
[](https://crates.io/crates/vigil) [](https://travis-ci.org/Metaswitch/Vigil) [](https://opensource.org/licenses/MIT) [](http://www.apache.org/licenses/LICENSE-2.0)
Software watchdog library for Rust services.
## Documentation
https://docs.rs/vigil/
## Usage
Install from crates.io by adding `vigil` to your `Cargo.toml`:
```
[dependencies]
vigil = "0.1"
```
Now you can create a Vigil instance which the watched code must notify every so often. If the watched code misses too many notification ticks, the pre-programmed callbacks will be fired to allow you to handle the situation (gather diagnostics, raise an alarm, cancel the stalled task, or even kill the whole process).
```rust
let vigil = Vigil::create(10_000,
Some(|| warn!("Watched code missed a watchdog check"),
Some(|| error!("Watched code missed multiple watchdog checks!"),
Some(|| { error!("Deadlock detected, exiting"); std::process::exit(101));
loop {
do_work();
vigil.notify();
}
```