1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//! [`ServeMeta`] identity and the JSON body for `GET /health`.
//!
//! The kit mounts `/health` inside [`crate::serve_router`]. Hosts can still define their own
//! health route if they merge a conflicting path (axum’s merge rules apply); prefer letting
//! panza own `/health` so `ok` / `service` / `version` / `uptime_secs` stay consistent.
use Instant;
use Serialize;
/// Service identity stamped into every [`HealthBody`].
///
/// Pass this into [`crate::run`] / [`crate::serve_router`]. Keep `service` short and stable
/// (crate or binary name); `version` is usually `env!("CARGO_PKG_VERSION")`.
///
/// This type is intentionally free of clocks or request state — uptime is computed when
/// building each [`HealthBody`].
/// JSON body returned by panza’s `GET /health`.
///
/// Example:
///
/// ```json
/// { "ok": true, "service": "ublx", "version": "0.1.10", "uptime_secs": 42 }
/// ```
///
/// `uptime_secs` is whole seconds since the [`Instant`] passed to [`HealthBody::from_meta`]
/// (panza uses the instant when [`crate::serve_router`] is called).