Skip to content

Commit

Permalink
rpc: wrapped logging with vlog macro
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Maslanka <michal@redpanda.com>
(cherry picked from commit 92228fb)
  • Loading branch information
mmaslankaprv authored and Michal Maslanka committed Feb 6, 2024
1 parent c415b9b commit db93dad
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
29 changes: 19 additions & 10 deletions src/v/rpc/rpc_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -210,37 +210,46 @@ ss::future<> rpc_server::dispatch_method_once(
ctx->pr.set_exception(e);
return ss::now();
} catch (const ss::timed_out_error& e) {
rpclog.debug("Timing out request on timed_out_error "
"(shutting down)");
vlog(
rpclog.debug,
"Timing out request on timed_out_error "
"(shutting down)");
reply_buf.set_status(rpc::status::request_timeout);
} catch (const ss::condition_variable_timed_out& e) {
rpclog.debug(
vlog(
rpclog.debug,
"Timing out request on condition_variable_timed_out");
reply_buf.set_status(rpc::status::request_timeout);
} catch (const ss::gate_closed_exception& e) {
// gate_closed is typical during shutdown. Treat
// it like a timeout: request was not erroneous
// but we will not give a rseponse.
rpclog.debug(
vlog(
rpclog.debug,
"Timing out request on gate_closed_exception "
"(shutting down)");
reply_buf.set_status(rpc::status::request_timeout);
} catch (const ss::broken_condition_variable& e) {
rpclog.debug(
vlog(
rpclog.debug,
"Timing out request on broken_condition_variable "
"(shutting down)");
reply_buf.set_status(rpc::status::request_timeout);
} catch (const ss::abort_requested_exception& e) {
rpclog.debug(
vlog(
rpclog.debug,
"Timing out request on abort_requested_exception "
"(shutting down)");
reply_buf.set_status(rpc::status::request_timeout);
} catch (const ss::broken_semaphore& e) {
rpclog.debug("Timing out request on broken_semaphore "
"(shutting down)");
vlog(
rpclog.debug,
"Timing out request on broken_semaphore "
"(shutting down)");
reply_buf.set_status(rpc::status::request_timeout);
} catch (...) {
rpclog.error(
vlog(
rpclog.error,
"Service handler threw an exception: {}",
std::current_exception());
probe().service_error();
Expand Down Expand Up @@ -268,7 +277,7 @@ ss::future<> rpc_server::dispatch_method_once(
});
})
.handle_exception([](const std::exception_ptr& e) {
rpclog.error("Error dispatching: {}", e);
vlog(rpclog.error, "Error dispatching: {}", e);
});

return fut;
Expand Down
6 changes: 4 additions & 2 deletions src/v/rpc/transport.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,14 @@ transport::connect(rpc::clock_type::time_point connection_timeout) {
} catch (...) {
auto e = std::current_exception();
if (net::is_disconnect_exception(e)) {
rpc::rpclog.info(
vlog(
rpc::rpclog.info,
"Disconnected from server {}: {}",
server_address(),
e);
} else {
rpc::rpclog.error(
vlog(
rpc::rpclog.error,
"Error dispatching client reads to {}: {}",
server_address(),
e);
Expand Down

0 comments on commit db93dad

Please sign in to comment.