feat(rpc): add /kona-rollup-boost/healthz endpoint#3130
feat(rpc): add /kona-rollup-boost/healthz endpoint#3130
Conversation
| /// The rollup boost health. | ||
| pub rollup_boost_health: mpsc::Sender<RollupBoostHealthQuery>, | ||
| } | ||
| #[derive(Debug, Default)] |
There was a problem hiding this comment.
If you import derive_more you can use derive_more::Constructor and remove the new method below
There was a problem hiding this comment.
Is it ok to use HealthzRpc::default() instead?
| health_tx: mpsc::Sender<RollupBoostHealthQuery>, | ||
| ) -> Result<ServerHandle, std::io::Error> { | ||
| let middleware = tower::ServiceBuilder::new() | ||
| .layer(RollupBoostHealthLayer::new(health_tx)) |
There was a problem hiding this comment.
Why is that implemented as a layer and not just a regular RPC endpoint?
There was a problem hiding this comment.
So jsonrpsee is a JSON-RPC server, which means everything comes back as HTTP 200 with a JSON body. even errors are just JSON-RPC error objects, not actual HTTP error codes. But the spec for this endpoint wants real HTTP status codes (200/206/503) with plain text bodies... can't do that with a normal RPC method. A tower layer lets us intercept the request before it hits jsonrpsee and just return a raw HTTP response.
| inner: S, | ||
| /// The rollup boost health query sender. | ||
| health_tx: mpsc::Sender<RollupBoostHealthQuery>, | ||
| } |
There was a problem hiding this comment.
This shouldn't be a middleware but a simple RPC endpoint. Can you implement this method the same way as we implemented the top-level healthz endpoint? You don't need to redefine a new struct or anything, just add a new method to HealthzApiClient
There was a problem hiding this comment.
See response above
Codecov Report❌ Patch coverage is
☔ View full report in Codecov by Sentry. |
|
Closing in favor of #3131 |
Summary
Separates rollup boost health into a dedicated
/kona-rollup-boost/healthzHTTP endpoint with proper status codes.Changes
/kona-rollup-boost/healthzwith HTTP status codes:200 OK— healthy206 Partial Content— L2 healthy but builder unhealthy503 Service Unavailable— L2 unhealthyrollup_boost_healthfield from/healthzresponseHealthzRpcto only return version info