-
Notifications
You must be signed in to change notification settings - Fork 1
Add health check endpoint code #82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
dmidem
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move to the bottom since that is the last rpc call that's added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same for snapshot_rpc_gethealthinfo and any other additions to existing RPC mechanism.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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" | ||
| ] | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove flag
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
V
PaulLaux
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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" }