-
Notifications
You must be signed in to change notification settings - Fork 179
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
Exposing GET handler for health check #762
Comments
You referring to the HTTP server correct? So currently, we have the middleware that you can use to collect metrics based on the timings but not a health API or any mean to register additional handlers. However, I have nothing against to expose a health API on the HTTP server sounds like a good idea. If you want to implement it that would be great. |
Yes thats correct. Awesome. It seems like a health check would be quite specific to the consumer service, since it might depend on the service implementation. Do you have an idea of what an interface might look like? |
I think the jsonrpc crate health API looks quite clean. I'm not exactly sure if how likely it's that folks would want to provide their own HTTP status codes, jsonrpc for instance let you define a RPC call and if that fails it will be converted to Would be neat to have something a bit more flexible such as (a closure could work too): trait HealthApi {
fn health(&self) -> (StatusCode, Body);
} server impl builder.health_api(set_handler());
match (request.method(), server.get_health_api()) {
(handler, Method::GET) {
let (status_code, body) = handler.health();
send_http_response(status_code, body);
}
} |
sorry @tarrencev I realized that we need this ASAP too. So I have opened #763 I hope that will fix things for you, sorry for not letting you implement that. we could revisit the API at a later point, if someone comes up with something more better. |
Closed by #763 |
Awesome appreciate you taking care of this! |
Is there a recommended approach to exposing a GET handler for i.e. health checks or metrics on the base server? It doesn't seem possible to register additional handlers today. I has hoping
build_from_hyper
would help with this but it still doesn't give access to the underlying service builder.Related eqlabs/pathfinder#194
The text was updated successfully, but these errors were encountered: