diff --git a/src/v/pandaproxy/api/api-doc/rest.json b/src/v/pandaproxy/api/api-doc/rest.json index f34d9368272e..44ebecbe7aee 100644 --- a/src/v/pandaproxy/api/api-doc/rest.json +++ b/src/v/pandaproxy/api/api-doc/rest.json @@ -547,4 +547,18 @@ } } } + }, + "/status/ready": { + "get": { + "summary": "Health check", + "operationId": "http_rest_status_ready", + "responses": { + "200": { + "description": "Success" + }, + "503": { + "description": "Service Unavailable" + } + } + } } \ No newline at end of file diff --git a/src/v/pandaproxy/rest/handlers.cc b/src/v/pandaproxy/rest/handlers.cc index 2d121d43d64f..fb25485ab8fb 100644 --- a/src/v/pandaproxy/rest/handlers.cc +++ b/src/v/pandaproxy/rest/handlers.cc @@ -493,4 +493,15 @@ post_consumer_offsets(server::request_t rq, server::reply_t rp) { }); } +ss::future +status_ready(proxy::server::request_t rq, proxy::server::reply_t rp) { + auto make_metadata_req = []() { + return kafka::metadata_request{.list_all_topics = false}; + }; + + auto res = co_await rq.dispatch(make_metadata_req); + rp.rep->set_status(ss::httpd::reply::status_type::ok); + co_return rp; +} + } // namespace pandaproxy::rest diff --git a/src/v/pandaproxy/rest/handlers.h b/src/v/pandaproxy/rest/handlers.h index 264cd4a071ee..ca4b854fec60 100644 --- a/src/v/pandaproxy/rest/handlers.h +++ b/src/v/pandaproxy/rest/handlers.h @@ -49,4 +49,7 @@ get_consumer_offsets(proxy::server::request_t rq, proxy::server::reply_t rp); ss::future post_consumer_offsets(proxy::server::request_t rq, proxy::server::reply_t rp); +ss::future +status_ready(proxy::server::request_t rq, proxy::server::reply_t rp); + } // namespace pandaproxy::rest diff --git a/src/v/pandaproxy/rest/proxy.cc b/src/v/pandaproxy/rest/proxy.cc index 7b0f83bd7ee9..561b371a4df1 100644 --- a/src/v/pandaproxy/rest/proxy.cc +++ b/src/v/pandaproxy/rest/proxy.cc @@ -96,6 +96,10 @@ server::routes_t get_proxy_routes(ss::gate& gate, one_shot& es) { ss::httpd::rest_json::post_consumer_offsets, wrap(gate, es, post_consumer_offsets)}); + routes.routes.emplace_back(server::route_t{ + ss::httpd::rest_json::http_rest_status_ready, + wrap(gate, es, status_ready)}); + return routes; }