| Crates.io | healthchecks |
| lib.rs | healthchecks |
| version | 3.2.0 |
| created_at | 2020-06-05 22:58:50.216244+00 |
| updated_at | 2025-08-25 17:45:07.109672+00 |
| description | Simple library to notify healthchecks.io from inside applications |
| homepage | https://github.com/msfjarvis/healthchecks-rs |
| repository | https://github.com/msfjarvis/healthchecks-rs |
| max_upload_size | |
| id | 250482 |
| size | 67,511 |
A simple Rust library that allows pinging healthchecks.io to indicate success or failure of a task.
use healthchecks::ping::get_client;
fn ping_api() {
let config = get_client("073305d2-3582-4dd6-b6a3-425e88583ca2").unwrap();
config.report_failure();
config.report_success();
}
If you want to set a custom user agent for filtering purposes (default is healthcheck-rs/$library_version)
use healthchecks::ping::get_client;
fn custom_user_agent() {
let config = get_client("073305d2-3582-4dd6-b6a3-425e88583ca2").unwrap().set_user_agent("very-fancy-useragent");
config.report_failure();
config.report_success();
}
You can also start a timer to record durations on healthchecks.io.
use healthchecks::ping::get_client;
fn do_long_running_task() {}
fn timer() {
let config = get_client("073305d2-3582-4dd6-b6a3-425e88583ca2").unwrap();
config.start_timer();
do_long_running_task();
config.report_success();
}
You can also specify a run ID for each ping to track concurrent executions of the same job. This allows healthchecks.io to correctly calculate execution times when multiple instances of the same job run concurrently.
use healthchecks::ping::get_client;
use uuid::Uuid;
fn do_long_running_task() {}
fn timer_with_run_id() {
// Generate a run ID (or use a deterministic method)
let run_id = Uuid::new_v4();
let config = get_client("073305d2-3582-4dd6-b6a3-425e88583ca2").unwrap();
config.start_timer_with_run_id(Some(&run_id));
do_long_running_task();
config.report_success_with_run_id(Some(&run_id));
}
healthchecks' MSRV is 1.82.0
Dual licensed under Apache 2.0 or MIT at your option.