Skip to content

Conversation

@seniakalma
Copy link
Collaborator

@seniakalma seniakalma commented Sep 3, 2025

Add health check endpoint via the original RPC server
The endpoint will return this data for any GET request:

curl -s http://127.0.0.1:8232/health

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"
}

@seniakalma seniakalma self-assigned this Sep 3, 2025
Copy link
Collaborator

@dmidem dmidem left a 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

Copy link
Collaborator

@dmidem dmidem left a 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).

@seniakalma seniakalma mentioned this pull request Sep 8, 2025
// 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>;
Copy link

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.

Copy link

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.

Copy link
Collaborator Author

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

Comment on lines 74 to 78
# Health RPC support
gethealthinfo-rpc = [
"zebra-rpc/gethealthinfo-rpc"
]

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove flag

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

V

Copy link

@PaulLaux PaulLaux left a 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.

@seniakalma
Copy link
Collaborator Author

Looks better. Please make sure It passes CI before submitting to review.

Fixed the CI.
I might add a step to not just check the format (and fail if it doesn't pass) but to actually fix the format with the cargo comment - What do you think @PaulLaux ?

@PaulLaux
Copy link

replaced by #84

@PaulLaux PaulLaux closed this Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants