Skip to content

Commit

Permalink
[PSM interop client] add flag to log RPC start and end
Browse files Browse the repository at this point in the history
  • Loading branch information
markdroth committed Dec 27, 2024
1 parent 6768331 commit ecc2755
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/cpp/interop/xds_interop_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ ABSL_FLAG(
"If true, XdsCredentials are used, InsecureChannelCredentials otherwise");
ABSL_FLAG(bool, enable_csm_observability, false,
"Whether to enable CSM Observability");
ABSL_FLAG(bool, log_rpc_start_and_end, false,
"Whether to log when RPCs start and end.");

using grpc::Channel;
using grpc::ClientAsyncResponseReader;
Expand Down Expand Up @@ -156,6 +158,9 @@ class TestClient {
? config.timeout_sec
: absl::GetFlag(FLAGS_rpc_timeout_sec));
AsyncClientCall* call = new AsyncClientCall;
if (absl::GetFlag(FLAGS_log_rpc_start_and_end)) {
LOG(INFO) << "starting async unary call " << static_cast<void*>(call);
}
for (const auto& data : config.metadata) {
call->context.AddMetadata(data.first, data.second);
// TODO(@donnadionne): move deadline to separate proto.
Expand Down Expand Up @@ -195,6 +200,9 @@ class TestClient {
? config.timeout_sec
: absl::GetFlag(FLAGS_rpc_timeout_sec));
AsyncClientCall* call = new AsyncClientCall;
if (absl::GetFlag(FLAGS_log_rpc_start_and_end)) {
LOG(INFO) << "starting async empty call " << static_cast<void*>(call);
}
for (const auto& data : config.metadata) {
call->context.AddMetadata(data.first, data.second);
// TODO(@donnadionne): move deadline to separate proto.
Expand All @@ -219,6 +227,9 @@ class TestClient {
while (cq_.Next(&got_tag, &ok)) {
AsyncClientCall* call = static_cast<AsyncClientCall*>(got_tag);
CHECK(ok);
if (absl::GetFlag(FLAGS_log_rpc_start_and_end)) {
LOG(INFO) << "completed async call " << static_cast<void*>(call);
}
{
std::lock_guard<std::mutex> lock(stats_watchers_->mu);
auto server_initial_metadata = call->context.GetServerInitialMetadata();
Expand Down

0 comments on commit ecc2755

Please sign in to comment.