Add health check endpoint code#82
Conversation
dmidem
left a comment
There was a problem hiding this comment.
Thank you, @seniakalma, the PR looks good to me. The only place I don't like is that we had to use a dummy GetHealthInfo structure when the gethealthinfo-rpc feature flag is disabled. But that's because of the #[rpc(server)] macro behavior - I couldn't find a better solution, so I simply mentioned that in the comment:
https://github.com/QED-it/zebra/blob/arseni-health-endpoint/zebra-rpc/src/methods.rs#L74-L75
dmidem
left a comment
There was a problem hiding this comment.
Looks good to me (see the previous comment).
zebra-rpc/src/methods.rs
Outdated
| // NOTE: We can't put a cfg with a feature flag on this method because #[rpc] ignores it. | ||
| // So we have to provide a dummy struct and a dummy impl below to support builds without the feature. | ||
| #[rpc(name = "gethealthinfo")] | ||
| fn get_health_info(&self) -> Result<GetHealthInfo>; |
There was a problem hiding this comment.
move to the bottom since that is the last rpc call that's added.
There was a problem hiding this comment.
same for snapshot_rpc_gethealthinfo and any other additions to existing RPC mechanism.
There was a problem hiding this comment.
Moved the gethealthinfo call to the very end of the first test function
And the last RPC call before the function ends
zebrad/Cargo.toml
Outdated
| # Health RPC support | ||
| gethealthinfo-rpc = [ | ||
| "zebra-rpc/gethealthinfo-rpc" | ||
| ] | ||
|
|
PaulLaux
left a comment
There was a problem hiding this comment.
Looks better. Please make sure It passes CI before submitting to review.
Fixed the CI. |
|
replaced by #84 |
Add health check endpoint via the original RPC server
The endpoint will return this data for any GET request:
response:
{ "status": "healthy", "version": "1.0.0-beta.41", "git_tag": "v1.0.0-rc.1", "git_commit": "75397cd59d0bac4b4c1e71187bb8af7494efb8b4", "timestamp": "2025-09-02T22:35:14.756599+00:00" }