rocket_health
๐ง Drop-in
/healthroute for Rocket APIs with uptime and rolling average latency metrics.
โจ Features
- ๐ Easy integration into any Rocket API
- ๐ Tracks server uptime
- โก Measures average response latency (rolling window)
- ๐ค Exposes
/healthroute returning structured JSON
Example response:
๐ฆ Installation
Add to your Cargo.toml:
[]
= "0.1"
= { = "0.5", = ["json"] }
๐ Usage
Step 1: Mount health route and fairing
extern crate rocket;
use mount_health_route;
Step 2: Start your Rocket app
The /health route is now available:
GET /health
Returns uptime and latency in seconds (float). Latency is computed using a sliding window of the last 100 requests.
๐งช Testing
You can unit test the handler or compute test coverage using cargo-tarpaulin: