[grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - gpr_log (#36526)

[grpc][Gpr_To_Absl_Logging] Migrating from gpr to absl logging - gpr_log

In this CL we are migrating from gRPCs own gpr logging mechanism to absl logging mechanism. The intention is to deprecate gpr_log in the future.

We have the following mapping
1. gpr_log(GPR_INFO,...) -> LOG(INFO)
2. gpr_log(GPR_ERROR,...) -> LOG(ERROR)
3. gpr_log(GPR_DEBUG,...) -> VLOG(2)

Reviewers need to check :
1. If the above mapping is correct.
2. The content of the log is as before.

gpr_log format strings did not use string_view or std::string . absl LOG accepts these. So there will be some elimination of string_view and std::string related conversions. This is expected.

Closes #36526

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/36526 from tanvi-jagtap:test_large_interop_client_gpr_log 46a657fe20
PiperOrigin-RevId: 630993244
pull/36536/head
Tanvi Jagtap 7 months ago committed by Copybara-Service
parent a20f020fb8
commit 7cc547dfd9
  1. 1
      test/cpp/interop/BUILD
  2. 339
      test/cpp/interop/interop_client.cc

@ -109,6 +109,7 @@ grpc_cc_library(
external_deps = [ external_deps = [
"absl/flags:flag", "absl/flags:flag",
"absl/log:check", "absl/log:check",
"absl/log:log",
], ],
language = "C++", language = "C++",
deps = [ deps = [

@ -27,6 +27,7 @@
#include "absl/cleanup/cleanup.h" #include "absl/cleanup/cleanup.h"
#include "absl/log/check.h" #include "absl/log/check.h"
#include "absl/log/log.h"
#include "absl/strings/match.h" #include "absl/strings/match.h"
#include "absl/strings/str_format.h" #include "absl/strings/str_format.h"
#include "absl/strings/str_join.h" #include "absl/strings/str_join.h"
@ -205,11 +206,10 @@ bool InteropClient::AssertStatusCode(const Status& s, StatusCode expected_code,
return true; return true;
} }
gpr_log(GPR_ERROR, LOG(ERROR) << "Error status code: " << s.error_code()
"Error status code: %d (expected: %d), message: %s," << " (expected: " << expected_code
" debug string: %s", << "), message: " << s.error_message()
s.error_code(), expected_code, s.error_message().c_str(), << ", debug string: " << optional_debug_string;
optional_debug_string.c_str());
// In case of transient transient/retryable failures (like a broken // In case of transient transient/retryable failures (like a broken
// connection) we may or may not abort (see TransientFailureOrAbort()) // connection) we may or may not abort (see TransientFailureOrAbort())
@ -221,7 +221,7 @@ bool InteropClient::AssertStatusCode(const Status& s, StatusCode expected_code,
} }
bool InteropClient::DoEmpty() { bool InteropClient::DoEmpty() {
gpr_log(GPR_DEBUG, "Sending an empty rpc..."); VLOG(2) << "Sending an empty rpc...";
Empty request; Empty request;
Empty response; Empty response;
@ -233,7 +233,7 @@ bool InteropClient::DoEmpty() {
return false; return false;
} }
gpr_log(GPR_DEBUG, "Empty rpc done."); VLOG(2) << "Empty rpc done.";
return true; return true;
} }
@ -273,8 +273,7 @@ bool InteropClient::PerformLargeUnary(SimpleRequest* request,
bool InteropClient::DoComputeEngineCreds( bool InteropClient::DoComputeEngineCreds(
const std::string& default_service_account, const std::string& default_service_account,
const std::string& oauth_scope) { const std::string& oauth_scope) {
gpr_log(GPR_DEBUG, VLOG(2) << "Sending a large unary rpc with compute engine credentials ...";
"Sending a large unary rpc with compute engine credentials ...");
SimpleRequest request; SimpleRequest request;
SimpleResponse response; SimpleResponse response;
request.set_fill_username(true); request.set_fill_username(true);
@ -284,21 +283,20 @@ bool InteropClient::DoComputeEngineCreds(
return false; return false;
} }
gpr_log(GPR_DEBUG, "Got username %s", response.username().c_str()); VLOG(2) << "Got username " << response.username();
gpr_log(GPR_DEBUG, "Got oauth_scope %s", response.oauth_scope().c_str()); VLOG(2) << "Got oauth_scope " << response.oauth_scope();
CHECK(!response.username().empty()); CHECK(!response.username().empty());
CHECK(response.username() == default_service_account); CHECK(response.username() == default_service_account);
CHECK(!response.oauth_scope().empty()); CHECK(!response.oauth_scope().empty());
const char* oauth_scope_str = response.oauth_scope().c_str(); const char* oauth_scope_str = response.oauth_scope().c_str();
CHECK(absl::StrContains(oauth_scope, oauth_scope_str)); CHECK(absl::StrContains(oauth_scope, oauth_scope_str));
gpr_log(GPR_DEBUG, "Large unary with compute engine creds done."); VLOG(2) << "Large unary with compute engine creds done.";
return true; return true;
} }
bool InteropClient::DoOauth2AuthToken(const std::string& username, bool InteropClient::DoOauth2AuthToken(const std::string& username,
const std::string& oauth_scope) { const std::string& oauth_scope) {
gpr_log(GPR_DEBUG, VLOG(2) << "Sending a unary rpc with raw oauth2 access token credentials ...";
"Sending a unary rpc with raw oauth2 access token credentials ...");
SimpleRequest request; SimpleRequest request;
SimpleResponse response; SimpleResponse response;
request.set_fill_username(true); request.set_fill_username(true);
@ -317,12 +315,12 @@ bool InteropClient::DoOauth2AuthToken(const std::string& username,
CHECK(username == response.username()); CHECK(username == response.username());
const char* oauth_scope_str = response.oauth_scope().c_str(); const char* oauth_scope_str = response.oauth_scope().c_str();
CHECK(absl::StrContains(oauth_scope, oauth_scope_str)); CHECK(absl::StrContains(oauth_scope, oauth_scope_str));
gpr_log(GPR_DEBUG, "Unary with oauth2 access token credentials done."); VLOG(2) << "Unary with oauth2 access token credentials done.";
return true; return true;
} }
bool InteropClient::DoPerRpcCreds(const std::string& json_key) { bool InteropClient::DoPerRpcCreds(const std::string& json_key) {
gpr_log(GPR_DEBUG, "Sending a unary rpc with per-rpc JWT access token ..."); VLOG(2) << "Sending a unary rpc with per-rpc JWT access token ...";
SimpleRequest request; SimpleRequest request;
SimpleResponse response; SimpleResponse response;
request.set_fill_username(true); request.set_fill_username(true);
@ -342,13 +340,12 @@ bool InteropClient::DoPerRpcCreds(const std::string& json_key) {
CHECK(!response.username().empty()); CHECK(!response.username().empty());
CHECK(json_key.find(response.username()) != std::string::npos); CHECK(json_key.find(response.username()) != std::string::npos);
gpr_log(GPR_DEBUG, "Unary with per-rpc JWT access token done."); VLOG(2) << "Unary with per-rpc JWT access token done.";
return true; return true;
} }
bool InteropClient::DoJwtTokenCreds(const std::string& username) { bool InteropClient::DoJwtTokenCreds(const std::string& username) {
gpr_log(GPR_DEBUG, VLOG(2) << "Sending a large unary rpc with JWT token credentials ...";
"Sending a large unary rpc with JWT token credentials ...");
SimpleRequest request; SimpleRequest request;
SimpleResponse response; SimpleResponse response;
request.set_fill_username(true); request.set_fill_username(true);
@ -359,14 +356,13 @@ bool InteropClient::DoJwtTokenCreds(const std::string& username) {
CHECK(!response.username().empty()); CHECK(!response.username().empty());
CHECK(username.find(response.username()) != std::string::npos); CHECK(username.find(response.username()) != std::string::npos);
gpr_log(GPR_DEBUG, "Large unary with JWT token creds done."); VLOG(2) << "Large unary with JWT token creds done.";
return true; return true;
} }
bool InteropClient::DoGoogleDefaultCredentials( bool InteropClient::DoGoogleDefaultCredentials(
const std::string& default_service_account) { const std::string& default_service_account) {
gpr_log(GPR_DEBUG, VLOG(2) << "Sending a large unary rpc with GoogleDefaultCredentials...";
"Sending a large unary rpc with GoogleDefaultCredentials...");
SimpleRequest request; SimpleRequest request;
SimpleResponse response; SimpleResponse response;
request.set_fill_username(true); request.set_fill_username(true);
@ -375,21 +371,21 @@ bool InteropClient::DoGoogleDefaultCredentials(
return false; return false;
} }
gpr_log(GPR_DEBUG, "Got username %s", response.username().c_str()); VLOG(2) << "Got username " << response.username();
CHECK(!response.username().empty()); CHECK(!response.username().empty());
CHECK(response.username() == default_service_account); CHECK(response.username() == default_service_account);
gpr_log(GPR_DEBUG, "Large unary rpc with GoogleDefaultCredentials done."); VLOG(2) << "Large unary rpc with GoogleDefaultCredentials done.";
return true; return true;
} }
bool InteropClient::DoLargeUnary() { bool InteropClient::DoLargeUnary() {
gpr_log(GPR_DEBUG, "Sending a large unary rpc..."); VLOG(2) << "Sending a large unary rpc...";
SimpleRequest request; SimpleRequest request;
SimpleResponse response; SimpleResponse response;
if (!PerformLargeUnary(&request, &response)) { if (!PerformLargeUnary(&request, &response)) {
return false; return false;
} }
gpr_log(GPR_DEBUG, "Large unary done."); VLOG(2) << "Large unary done.";
return true; return true;
} }
@ -405,35 +401,32 @@ bool InteropClient::DoClientCompressedUnary() {
probe_req.set_response_size(kLargeResponseSize); probe_req.set_response_size(kLargeResponseSize);
probe_req.mutable_payload()->set_body(std::string(kLargeRequestSize, '\0')); probe_req.mutable_payload()->set_body(std::string(kLargeRequestSize, '\0'));
gpr_log(GPR_DEBUG, "Sending probe for compressed unary request."); VLOG(2) << "Sending probe for compressed unary request.";
const Status s = const Status s =
serviceStub_.Get()->UnaryCall(&probe_context, probe_req, &probe_res); serviceStub_.Get()->UnaryCall(&probe_context, probe_req, &probe_res);
if (s.error_code() != grpc::StatusCode::INVALID_ARGUMENT) { if (s.error_code() != grpc::StatusCode::INVALID_ARGUMENT) {
// The server isn't able to evaluate incoming compression, making the rest // The server isn't able to evaluate incoming compression, making the rest
// of this test moot. // of this test moot.
gpr_log(GPR_DEBUG, "Compressed unary request probe failed"); VLOG(2) << "Compressed unary request probe failed";
return false; return false;
} }
gpr_log(GPR_DEBUG, "Compressed unary request probe succeeded. Proceeding."); VLOG(2) << "Compressed unary request probe succeeded. Proceeding.";
const std::vector<bool> compressions = {true, false}; const std::vector<bool> compressions = {true, false};
for (size_t i = 0; i < compressions.size(); i++) { for (size_t i = 0; i < compressions.size(); i++) {
std::string log_suffix = std::string log_suffix =
absl::StrFormat("(compression=%s)", compressions[i] ? "true" : "false"); absl::StrFormat("(compression=%s)", compressions[i] ? "true" : "false");
gpr_log(GPR_DEBUG, "Sending compressed unary request %s.", VLOG(2) << "Sending compressed unary request " << log_suffix;
log_suffix.c_str());
SimpleRequest request; SimpleRequest request;
SimpleResponse response; SimpleResponse response;
request.mutable_expect_compressed()->set_value(compressions[i]); request.mutable_expect_compressed()->set_value(compressions[i]);
if (!PerformLargeUnary(&request, &response, UnaryCompressionChecks)) { if (!PerformLargeUnary(&request, &response, UnaryCompressionChecks)) {
gpr_log(GPR_ERROR, "Compressed unary request failed %s", LOG(ERROR) << "Compressed unary request failed " << log_suffix;
log_suffix.c_str());
return false; return false;
} }
gpr_log(GPR_DEBUG, "Compressed unary request failed %s", VLOG(2) << "Compressed unary request failed " << log_suffix;
log_suffix.c_str());
} }
return true; return true;
@ -445,20 +438,17 @@ bool InteropClient::DoServerCompressedUnary() {
std::string log_suffix = std::string log_suffix =
absl::StrFormat("(compression=%s)", compressions[i] ? "true" : "false"); absl::StrFormat("(compression=%s)", compressions[i] ? "true" : "false");
gpr_log(GPR_DEBUG, "Sending unary request for compressed response %s.", VLOG(2) << "Sending unary request for compressed response " << log_suffix;
log_suffix.c_str());
SimpleRequest request; SimpleRequest request;
SimpleResponse response; SimpleResponse response;
request.mutable_response_compressed()->set_value(compressions[i]); request.mutable_response_compressed()->set_value(compressions[i]);
if (!PerformLargeUnary(&request, &response, UnaryCompressionChecks)) { if (!PerformLargeUnary(&request, &response, UnaryCompressionChecks)) {
gpr_log(GPR_ERROR, "Request for compressed unary failed %s", LOG(ERROR) << "Request for compressed unary failed " << log_suffix;
log_suffix.c_str());
return false; return false;
} }
gpr_log(GPR_DEBUG, "Request for compressed unary failed %s", VLOG(2) << "Request for compressed unary failed " << log_suffix;
log_suffix.c_str());
} }
return true; return true;
@ -475,7 +465,7 @@ bool InteropClient::TransientFailureOrAbort() {
} }
bool InteropClient::DoRequestStreaming() { bool InteropClient::DoRequestStreaming() {
gpr_log(GPR_DEBUG, "Sending request steaming rpc ..."); VLOG(2) << "Sending request steaming rpc ...";
ClientContext context; ClientContext context;
StreamingInputCallRequest request; StreamingInputCallRequest request;
@ -489,7 +479,7 @@ bool InteropClient::DoRequestStreaming() {
Payload* payload = request.mutable_payload(); Payload* payload = request.mutable_payload();
payload->set_body(std::string(request_stream_sizes[i], '\0')); payload->set_body(std::string(request_stream_sizes[i], '\0'));
if (!stream->Write(request)) { if (!stream->Write(request)) {
gpr_log(GPR_ERROR, "DoRequestStreaming(): stream->Write() failed"); LOG(ERROR) << "DoRequestStreaming(): stream->Write() failed.";
return TransientFailureOrAbort(); return TransientFailureOrAbort();
} }
aggregated_payload_size += request_stream_sizes[i]; aggregated_payload_size += request_stream_sizes[i];
@ -506,7 +496,7 @@ bool InteropClient::DoRequestStreaming() {
} }
bool InteropClient::DoResponseStreaming() { bool InteropClient::DoResponseStreaming() {
gpr_log(GPR_DEBUG, "Receiving response streaming rpc ..."); VLOG(2) << "Receiving response streaming rpc ...";
ClientContext context; ClientContext context;
StreamingOutputCallRequest request; StreamingOutputCallRequest request;
@ -528,10 +518,9 @@ bool InteropClient::DoResponseStreaming() {
if (i < response_stream_sizes.size()) { if (i < response_stream_sizes.size()) {
// stream->Read() failed before reading all the expected messages. This is // stream->Read() failed before reading all the expected messages. This is
// most likely due to connection failure. // most likely due to connection failure.
gpr_log(GPR_ERROR, LOG(ERROR) << "DoResponseStreaming(): Read fewer streams (" << i
"DoResponseStreaming(): Read fewer streams (%d) than " << ") than response_stream_sizes.size() ("
"response_stream_sizes.size() (%" PRIuPTR ")", << response_stream_sizes.size() << ")";
i, response_stream_sizes.size());
return TransientFailureOrAbort(); return TransientFailureOrAbort();
} }
@ -540,7 +529,7 @@ bool InteropClient::DoResponseStreaming() {
return false; return false;
} }
gpr_log(GPR_DEBUG, "Response streaming done."); VLOG(2) << "Response streaming done.";
return true; return true;
} }
@ -554,24 +543,23 @@ bool InteropClient::DoClientCompressedStreaming() {
probe_req.mutable_expect_compressed()->set_value(true); // lies! probe_req.mutable_expect_compressed()->set_value(true); // lies!
probe_req.mutable_payload()->set_body(std::string(27182, '\0')); probe_req.mutable_payload()->set_body(std::string(27182, '\0'));
gpr_log(GPR_DEBUG, "Sending probe for compressed streaming request."); VLOG(2) << "Sending probe for compressed streaming request.";
std::unique_ptr<ClientWriter<StreamingInputCallRequest>> probe_stream( std::unique_ptr<ClientWriter<StreamingInputCallRequest>> probe_stream(
serviceStub_.Get()->StreamingInputCall(&probe_context, &probe_res)); serviceStub_.Get()->StreamingInputCall(&probe_context, &probe_res));
if (!probe_stream->Write(probe_req)) { if (!probe_stream->Write(probe_req)) {
gpr_log(GPR_ERROR, "%s(): stream->Write() failed", __func__); LOG(ERROR) << __func__ << "(): stream->Write() failed";
return TransientFailureOrAbort(); return TransientFailureOrAbort();
} }
Status s = probe_stream->Finish(); Status s = probe_stream->Finish();
if (s.error_code() != grpc::StatusCode::INVALID_ARGUMENT) { if (s.error_code() != grpc::StatusCode::INVALID_ARGUMENT) {
// The server isn't able to evaluate incoming compression, making the rest // The server isn't able to evaluate incoming compression, making the rest
// of this test moot. // of this test moot.
gpr_log(GPR_DEBUG, "Compressed streaming request probe failed"); VLOG(2) << "Compressed streaming request probe failed";
return false; return false;
} }
gpr_log(GPR_DEBUG, VLOG(2) << "Compressed streaming request probe succeeded. Proceeding.";
"Compressed streaming request probe succeeded. Proceeding.");
ClientContext context; ClientContext context;
StreamingInputCallRequest request; StreamingInputCallRequest request;
@ -583,9 +571,9 @@ bool InteropClient::DoClientCompressedStreaming() {
request.mutable_payload()->set_body(std::string(27182, '\0')); request.mutable_payload()->set_body(std::string(27182, '\0'));
request.mutable_expect_compressed()->set_value(true); request.mutable_expect_compressed()->set_value(true);
gpr_log(GPR_DEBUG, "Sending streaming request with compression enabled"); VLOG(2) << "Sending streaming request with compression enabled";
if (!stream->Write(request)) { if (!stream->Write(request)) {
gpr_log(GPR_ERROR, "%s(): stream->Write() failed", __func__); LOG(ERROR) << __func__ << "(): stream->Write() failed.";
return TransientFailureOrAbort(); return TransientFailureOrAbort();
} }
@ -593,9 +581,9 @@ bool InteropClient::DoClientCompressedStreaming() {
wopts.set_no_compression(); wopts.set_no_compression();
request.mutable_payload()->set_body(std::string(45904, '\0')); request.mutable_payload()->set_body(std::string(45904, '\0'));
request.mutable_expect_compressed()->set_value(false); request.mutable_expect_compressed()->set_value(false);
gpr_log(GPR_DEBUG, "Sending streaming request with compression disabled"); VLOG(2) << "Sending streaming request with compression disabled";
if (!stream->Write(request, wopts)) { if (!stream->Write(request, wopts)) {
gpr_log(GPR_ERROR, "%s(): stream->Write() failed", __func__); LOG(ERROR) << __func__ << "(): stream->Write() failed";
return TransientFailureOrAbort(); return TransientFailureOrAbort();
} }
CHECK(stream->WritesDone()); CHECK(stream->WritesDone());
@ -618,7 +606,7 @@ bool InteropClient::DoServerCompressedStreaming() {
absl::StrFormat("(compression=%s; size=%d)", absl::StrFormat("(compression=%s; size=%d)",
compressions[i] ? "true" : "false", sizes[i]); compressions[i] ? "true" : "false", sizes[i]);
gpr_log(GPR_DEBUG, "Sending request streaming rpc %s.", log_suffix.c_str()); VLOG(2) << "Sending request streaming rpc " << log_suffix.c_str();
ResponseParameters* const response_parameter = ResponseParameters* const response_parameter =
request.add_response_parameters(); request.add_response_parameters();
@ -650,10 +638,9 @@ bool InteropClient::DoServerCompressedStreaming() {
if (k < sizes.size()) { if (k < sizes.size()) {
// stream->Read() failed before reading all the expected messages. This // stream->Read() failed before reading all the expected messages. This
// is most likely due to a connection failure. // is most likely due to a connection failure.
gpr_log(GPR_ERROR, LOG(ERROR) << __func__ << "(): Responses read (k=" << k
"%s(): Responses read (k=%" PRIuPTR << ") is less than the expected number of messages ("
") is less than the expected number of messages (%" PRIuPTR ").", << sizes.size() << ").";
__func__, k, sizes.size());
return TransientFailureOrAbort(); return TransientFailureOrAbort();
} }
@ -662,7 +649,7 @@ bool InteropClient::DoServerCompressedStreaming() {
} }
bool InteropClient::DoResponseStreamingWithSlowConsumer() { bool InteropClient::DoResponseStreamingWithSlowConsumer() {
gpr_log(GPR_DEBUG, "Receiving response streaming rpc with slow consumer ..."); VLOG(2) << "Receiving response streaming rpc with slow consumer ...";
ClientContext context; ClientContext context;
StreamingOutputCallRequest request; StreamingOutputCallRequest request;
@ -678,7 +665,7 @@ bool InteropClient::DoResponseStreamingWithSlowConsumer() {
int i = 0; int i = 0;
while (stream->Read(&response)) { while (stream->Read(&response)) {
CHECK(response.payload().body() == std::string(kResponseMessageSize, '\0')); CHECK(response.payload().body() == std::string(kResponseMessageSize, '\0'));
gpr_log(GPR_DEBUG, "received message %d", i); VLOG(2) << "received message " << i;
gpr_sleep_until(gpr_time_add( gpr_sleep_until(gpr_time_add(
gpr_now(GPR_CLOCK_REALTIME), gpr_now(GPR_CLOCK_REALTIME),
gpr_time_from_millis(kReceiveDelayMilliSeconds, GPR_TIMESPAN))); gpr_time_from_millis(kReceiveDelayMilliSeconds, GPR_TIMESPAN)));
@ -686,10 +673,11 @@ bool InteropClient::DoResponseStreamingWithSlowConsumer() {
} }
if (i < kNumResponseMessages) { if (i < kNumResponseMessages) {
gpr_log(GPR_ERROR, LOG(ERROR) << "DoResponseStreamingWithSlowConsumer(): Responses read (i="
"DoResponseStreamingWithSlowConsumer(): Responses read (i=%d) is " << i
"less than the expected messages (i.e kNumResponseMessages = %d)", << ") is less than the expected messages (i.e "
i, kNumResponseMessages); "kNumResponseMessages = "
<< kNumResponseMessages << ").";
return TransientFailureOrAbort(); return TransientFailureOrAbort();
} }
@ -699,12 +687,12 @@ bool InteropClient::DoResponseStreamingWithSlowConsumer() {
return false; return false;
} }
gpr_log(GPR_DEBUG, "Response streaming done."); VLOG(2) << "Response streaming done.";
return true; return true;
} }
bool InteropClient::DoHalfDuplex() { bool InteropClient::DoHalfDuplex() {
gpr_log(GPR_DEBUG, "Sending half-duplex streaming rpc ..."); VLOG(2) << "Sending half-duplex streaming rpc ...";
ClientContext context; ClientContext context;
std::unique_ptr<ClientReaderWriter<StreamingOutputCallRequest, std::unique_ptr<ClientReaderWriter<StreamingOutputCallRequest,
@ -717,7 +705,7 @@ bool InteropClient::DoHalfDuplex() {
response_parameter->set_size(response_stream_sizes[i]); response_parameter->set_size(response_stream_sizes[i]);
if (!stream->Write(request)) { if (!stream->Write(request)) {
gpr_log(GPR_ERROR, "DoHalfDuplex(): stream->Write() failed. i=%d", i); LOG(ERROR) << "DoHalfDuplex(): stream->Write() failed. i=" << i;
return TransientFailureOrAbort(); return TransientFailureOrAbort();
} }
} }
@ -734,10 +722,10 @@ bool InteropClient::DoHalfDuplex() {
if (i < response_stream_sizes.size()) { if (i < response_stream_sizes.size()) {
// stream->Read() failed before reading all the expected messages. This is // stream->Read() failed before reading all the expected messages. This is
// most likely due to a connection failure // most likely due to a connection failure
gpr_log(GPR_ERROR, LOG(ERROR) << "DoHalfDuplex(): Responses read (i=" << i
"DoHalfDuplex(): Responses read (i=%d) are less than the expected " << ") are less than the expected number of messages "
"number of messages response_stream_sizes.size() (%" PRIuPTR ")", "response_stream_sizes.size() ("
i, response_stream_sizes.size()); << response_stream_sizes.size() << ").";
return TransientFailureOrAbort(); return TransientFailureOrAbort();
} }
@ -746,12 +734,12 @@ bool InteropClient::DoHalfDuplex() {
return false; return false;
} }
gpr_log(GPR_DEBUG, "Half-duplex streaming rpc done."); VLOG(2) << "Half-duplex streaming rpc done.";
return true; return true;
} }
bool InteropClient::DoPingPong() { bool InteropClient::DoPingPong() {
gpr_log(GPR_DEBUG, "Sending Ping Pong streaming rpc ..."); VLOG(2) << "Sending Ping Pong streaming rpc ...";
ClientContext context; ClientContext context;
std::unique_ptr<ClientReaderWriter<StreamingOutputCallRequest, std::unique_ptr<ClientReaderWriter<StreamingOutputCallRequest,
@ -768,12 +756,12 @@ bool InteropClient::DoPingPong() {
payload->set_body(std::string(request_stream_sizes[i], '\0')); payload->set_body(std::string(request_stream_sizes[i], '\0'));
if (!stream->Write(request)) { if (!stream->Write(request)) {
gpr_log(GPR_ERROR, "DoPingPong(): stream->Write() failed. i: %d", i); LOG(ERROR) << "DoPingPong(): stream->Write() failed. i: " << i;
return TransientFailureOrAbort(); return TransientFailureOrAbort();
} }
if (!stream->Read(&response)) { if (!stream->Read(&response)) {
gpr_log(GPR_ERROR, "DoPingPong(): stream->Read() failed. i:%d", i); LOG(ERROR) << "DoPingPong(): stream->Read() failed. i:" << i;
return TransientFailureOrAbort(); return TransientFailureOrAbort();
} }
@ -790,12 +778,12 @@ bool InteropClient::DoPingPong() {
return false; return false;
} }
gpr_log(GPR_DEBUG, "Ping pong streaming done."); VLOG(2) << "Ping pong streaming done.";
return true; return true;
} }
bool InteropClient::DoCancelAfterBegin() { bool InteropClient::DoCancelAfterBegin() {
gpr_log(GPR_DEBUG, "Sending request streaming rpc ..."); VLOG(2) << "Sending request streaming rpc ...";
ClientContext context; ClientContext context;
StreamingInputCallRequest request; StreamingInputCallRequest request;
@ -804,7 +792,7 @@ bool InteropClient::DoCancelAfterBegin() {
std::unique_ptr<ClientWriter<StreamingInputCallRequest>> stream( std::unique_ptr<ClientWriter<StreamingInputCallRequest>> stream(
serviceStub_.Get()->StreamingInputCall(&context, &response)); serviceStub_.Get()->StreamingInputCall(&context, &response));
gpr_log(GPR_DEBUG, "Trying to cancel..."); VLOG(2) << "Trying to cancel...";
context.TryCancel(); context.TryCancel();
Status s = stream->Finish(); Status s = stream->Finish();
@ -813,12 +801,12 @@ bool InteropClient::DoCancelAfterBegin() {
return false; return false;
} }
gpr_log(GPR_DEBUG, "Canceling streaming done."); VLOG(2) << "Canceling streaming done.";
return true; return true;
} }
bool InteropClient::DoCancelAfterFirstResponse() { bool InteropClient::DoCancelAfterFirstResponse() {
gpr_log(GPR_DEBUG, "Sending Ping Pong streaming rpc ..."); VLOG(2) << "Sending Ping Pong streaming rpc ...";
ClientContext context; ClientContext context;
std::unique_ptr<ClientReaderWriter<StreamingOutputCallRequest, std::unique_ptr<ClientReaderWriter<StreamingOutputCallRequest,
@ -832,27 +820,26 @@ bool InteropClient::DoCancelAfterFirstResponse() {
StreamingOutputCallResponse response; StreamingOutputCallResponse response;
if (!stream->Write(request)) { if (!stream->Write(request)) {
gpr_log(GPR_ERROR, "DoCancelAfterFirstResponse(): stream->Write() failed"); LOG(ERROR) << "DoCancelAfterFirstResponse(): stream->Write() failed";
return TransientFailureOrAbort(); return TransientFailureOrAbort();
} }
if (!stream->Read(&response)) { if (!stream->Read(&response)) {
gpr_log(GPR_ERROR, "DoCancelAfterFirstResponse(): stream->Read failed"); LOG(ERROR) << "DoCancelAfterFirstResponse(): stream->Read failed";
return TransientFailureOrAbort(); return TransientFailureOrAbort();
} }
CHECK(response.payload().body() == std::string(31415, '\0')); CHECK(response.payload().body() == std::string(31415, '\0'));
gpr_log(GPR_DEBUG, "Trying to cancel..."); VLOG(2) << "Trying to cancel...";
context.TryCancel(); context.TryCancel();
Status s = stream->Finish(); Status s = stream->Finish();
gpr_log(GPR_DEBUG, "Canceling pingpong streaming done."); VLOG(2) << "Canceling pingpong streaming done.";
return true; return true;
} }
bool InteropClient::DoTimeoutOnSleepingServer() { bool InteropClient::DoTimeoutOnSleepingServer() {
gpr_log(GPR_DEBUG, VLOG(2) << "Sending Ping Pong streaming rpc with a short deadline...";
"Sending Ping Pong streaming rpc with a short deadline...");
ClientContext context; ClientContext context;
std::chrono::system_clock::time_point deadline = std::chrono::system_clock::time_point deadline =
@ -872,12 +859,12 @@ bool InteropClient::DoTimeoutOnSleepingServer() {
return false; return false;
} }
gpr_log(GPR_DEBUG, "Pingpong streaming timeout done."); VLOG(2) << "Pingpong streaming timeout done.";
return true; return true;
} }
bool InteropClient::DoEmptyStream() { bool InteropClient::DoEmptyStream() {
gpr_log(GPR_DEBUG, "Starting empty_stream."); VLOG(2) << "Starting empty_stream.";
ClientContext context; ClientContext context;
std::unique_ptr<ClientReaderWriter<StreamingOutputCallRequest, std::unique_ptr<ClientReaderWriter<StreamingOutputCallRequest,
@ -892,13 +879,12 @@ bool InteropClient::DoEmptyStream() {
return false; return false;
} }
gpr_log(GPR_DEBUG, "empty_stream done."); VLOG(2) << "empty_stream done.";
return true; return true;
} }
bool InteropClient::DoStatusWithMessage() { bool InteropClient::DoStatusWithMessage() {
gpr_log(GPR_DEBUG, VLOG(2) << "Sending RPC with a request for status code 2 and message";
"Sending RPC with a request for status code 2 and message");
const grpc::StatusCode test_code = grpc::StatusCode::UNKNOWN; const grpc::StatusCode test_code = grpc::StatusCode::UNKNOWN;
const std::string test_msg = "This is a test message"; const std::string test_msg = "This is a test message";
@ -938,15 +924,14 @@ bool InteropClient::DoStatusWithMessage() {
} }
CHECK(s.error_message() == test_msg); CHECK(s.error_message() == test_msg);
gpr_log(GPR_DEBUG, "Done testing Status and Message"); VLOG(2) << "Done testing Status and Message";
return true; return true;
} }
bool InteropClient::DoSpecialStatusMessage() { bool InteropClient::DoSpecialStatusMessage() {
gpr_log( VLOG(2) << "Sending RPC with a request for status code 2 and message - "
GPR_DEBUG, "\\t\\ntest "
"Sending RPC with a request for status code 2 and message - \\t\\ntest " "with whitespace\\r\\nand Unicode BMP ☺ and non-BMP 😈\\t\\n";
"with whitespace\\r\\nand Unicode BMP ☺ and non-BMP 😈\\t\\n");
const grpc::StatusCode test_code = grpc::StatusCode::UNKNOWN; const grpc::StatusCode test_code = grpc::StatusCode::UNKNOWN;
const std::string test_msg = const std::string test_msg =
"\t\ntest with whitespace\r\nand Unicode BMP ☺ and non-BMP 😈\t\n"; "\t\ntest with whitespace\r\nand Unicode BMP ☺ and non-BMP 😈\t\n";
@ -962,7 +947,7 @@ bool InteropClient::DoSpecialStatusMessage() {
return false; return false;
} }
CHECK(s.error_message() == test_msg); CHECK(s.error_message() == test_msg);
gpr_log(GPR_DEBUG, "Done testing Special Status Message"); VLOG(2) << "Done testing Special Status Message";
return true; return true;
} }
@ -983,19 +968,19 @@ bool InteropClient::DoPickFirstUnary() {
continue; continue;
} }
if (response.server_id() != server_id) { if (response.server_id() != server_id) {
gpr_log(GPR_ERROR, "#%d rpc hits server_id %s, expect server_id %s", i, LOG(ERROR) << "#" << i << " rpc hits server_id " << response.server_id()
response.server_id().c_str(), server_id.c_str()); << ", expect server_id " << server_id;
return false; return false;
} }
} }
gpr_log(GPR_DEBUG, "pick first unary successfully finished"); VLOG(2) << "pick first unary successfully finished";
return true; return true;
} }
bool InteropClient::DoOrcaPerRpc() { bool InteropClient::DoOrcaPerRpc() {
load_report_tracker_.ResetCollectedLoadReports(); load_report_tracker_.ResetCollectedLoadReports();
grpc_core::CoreConfiguration::RegisterBuilder(RegisterBackendMetricsLbPolicy); grpc_core::CoreConfiguration::RegisterBuilder(RegisterBackendMetricsLbPolicy);
gpr_log(GPR_DEBUG, "testing orca per rpc"); VLOG(2) << "testing orca per rpc";
SimpleRequest request; SimpleRequest request;
SimpleResponse response; SimpleResponse response;
ClientContext context; ClientContext context;
@ -1016,13 +1001,13 @@ bool InteropClient::DoOrcaPerRpc() {
gpr_assertion_failed(__FILE__, __LINE__, comparison_result->c_str()); gpr_assertion_failed(__FILE__, __LINE__, comparison_result->c_str());
} }
CHECK(!load_report_tracker_.GetNextLoadReport().has_value()); CHECK(!load_report_tracker_.GetNextLoadReport().has_value());
gpr_log(GPR_DEBUG, "orca per rpc successfully finished"); VLOG(2) << "orca per rpc successfully finished";
return true; return true;
} }
bool InteropClient::DoOrcaOob() { bool InteropClient::DoOrcaOob() {
static constexpr auto kTimeout = absl::Seconds(10); static constexpr auto kTimeout = absl::Seconds(10);
gpr_log(GPR_INFO, "testing orca oob"); LOG(INFO) << "testing orca oob";
load_report_tracker_.ResetCollectedLoadReports(); load_report_tracker_.ResetCollectedLoadReports();
// Make the backup poller poll very frequently in order to pick up // Make the backup poller poll very frequently in order to pick up
// updates from all the subchannels's FDs. // updates from all the subchannels's FDs.
@ -1047,11 +1032,11 @@ bool InteropClient::DoOrcaOob() {
orca_report->mutable_utilization()->emplace("util", 0.30499); orca_report->mutable_utilization()->emplace("util", 0.30499);
StreamingOutputCallResponse response; StreamingOutputCallResponse response;
if (!stream->Write(request)) { if (!stream->Write(request)) {
gpr_log(GPR_ERROR, "DoOrcaOob(): stream->Write() failed"); LOG(ERROR) << "DoOrcaOob(): stream->Write() failed";
return TransientFailureOrAbort(); return TransientFailureOrAbort();
} }
if (!stream->Read(&response)) { if (!stream->Read(&response)) {
gpr_log(GPR_ERROR, "DoOrcaOob(): stream->Read failed"); LOG(ERROR) << "DoOrcaOob(): stream->Read failed";
return TransientFailureOrAbort(); return TransientFailureOrAbort();
} }
CHECK(load_report_tracker_ CHECK(load_report_tracker_
@ -1059,8 +1044,7 @@ bool InteropClient::DoOrcaOob() {
[orca_report](const auto& actual) { [orca_report](const auto& actual) {
auto value = OrcaLoadReportsDiff(*orca_report, actual); auto value = OrcaLoadReportsDiff(*orca_report, actual);
if (value.has_value()) { if (value.has_value()) {
gpr_log(GPR_DEBUG, "Reports mismatch: %s", VLOG(2) << "Reports mismatch: " << value->c_str();
value->c_str());
return false; return false;
} }
return true; return true;
@ -1077,11 +1061,11 @@ bool InteropClient::DoOrcaOob() {
orca_report->mutable_utilization()->emplace("util", 0.2039); orca_report->mutable_utilization()->emplace("util", 0.2039);
StreamingOutputCallResponse response; StreamingOutputCallResponse response;
if (!stream->Write(request)) { if (!stream->Write(request)) {
gpr_log(GPR_ERROR, "DoOrcaOob(): stream->Write() failed"); LOG(ERROR) << "DoOrcaOob(): stream->Write() failed";
return TransientFailureOrAbort(); return TransientFailureOrAbort();
} }
if (!stream->Read(&response)) { if (!stream->Read(&response)) {
gpr_log(GPR_ERROR, "DoOrcaOob(): stream->Read failed"); LOG(ERROR) << "DoOrcaOob(): stream->Read failed";
return TransientFailureOrAbort(); return TransientFailureOrAbort();
} }
CHECK( CHECK(
@ -1093,7 +1077,7 @@ bool InteropClient::DoOrcaOob() {
kTimeout, 10) kTimeout, 10)
.has_value()); .has_value());
} }
gpr_log(GPR_INFO, "orca oob successfully finished"); LOG(INFO) << "orca oob successfully finished";
return true; return true;
} }
@ -1105,7 +1089,7 @@ bool InteropClient::DoCustomMetadata() {
const std::string kTrailingBinValue("\x0a\x0b\x0a\x0b\x0a\x0b"); const std::string kTrailingBinValue("\x0a\x0b\x0a\x0b\x0a\x0b");
{ {
gpr_log(GPR_DEBUG, "Sending RPC with custom metadata"); VLOG(2) << "Sending RPC with custom metadata";
ClientContext context; ClientContext context;
context.AddMetadata(kEchoInitialMetadataKey, kInitialMetadataValue); context.AddMetadata(kEchoInitialMetadataKey, kInitialMetadataValue);
context.AddMetadata(kEchoTrailingBinMetadataKey, kTrailingBinValue); context.AddMetadata(kEchoTrailingBinMetadataKey, kTrailingBinValue);
@ -1130,11 +1114,11 @@ bool InteropClient::DoCustomMetadata() {
CHECK(std::string(iter->second.begin(), iter->second.end()) == CHECK(std::string(iter->second.begin(), iter->second.end()) ==
kTrailingBinValue); kTrailingBinValue);
gpr_log(GPR_DEBUG, "Done testing RPC with custom metadata"); VLOG(2) << "Done testing RPC with custom metadata";
} }
{ {
gpr_log(GPR_DEBUG, "Sending stream with custom metadata"); VLOG(2) << "Sending stream with custom metadata";
ClientContext context; ClientContext context;
context.AddMetadata(kEchoInitialMetadataKey, kInitialMetadataValue); context.AddMetadata(kEchoInitialMetadataKey, kInitialMetadataValue);
context.AddMetadata(kEchoTrailingBinMetadataKey, kTrailingBinValue); context.AddMetadata(kEchoTrailingBinMetadataKey, kTrailingBinValue);
@ -1150,14 +1134,14 @@ bool InteropClient::DoCustomMetadata() {
StreamingOutputCallResponse response; StreamingOutputCallResponse response;
if (!stream->Write(request)) { if (!stream->Write(request)) {
gpr_log(GPR_ERROR, "DoCustomMetadata(): stream->Write() failed"); LOG(ERROR) << "DoCustomMetadata(): stream->Write() failed";
return TransientFailureOrAbort(); return TransientFailureOrAbort();
} }
stream->WritesDone(); stream->WritesDone();
if (!stream->Read(&response)) { if (!stream->Read(&response)) {
gpr_log(GPR_ERROR, "DoCustomMetadata(): stream->Read() failed"); LOG(ERROR) << "DoCustomMetadata(): stream->Read() failed";
return TransientFailureOrAbort(); return TransientFailureOrAbort();
} }
@ -1180,7 +1164,7 @@ bool InteropClient::DoCustomMetadata() {
CHECK(std::string(iter->second.begin(), iter->second.end()) == CHECK(std::string(iter->second.begin(), iter->second.end()) ==
kTrailingBinValue); kTrailingBinValue);
gpr_log(GPR_DEBUG, "Done testing stream with custom metadata"); VLOG(2) << "Done testing stream with custom metadata";
} }
return true; return true;
@ -1254,17 +1238,14 @@ void InteropClient::PerformSoakTest(
std::string peer = std::get<3>(result); std::string peer = std::get<3>(result);
results.push_back(result); results.push_back(result);
if (!success) { if (!success) {
gpr_log(GPR_INFO, LOG(INFO) << "soak iteration: " << i << " elapsed_ms: " << elapsed_ms
"soak iteration: %d elapsed_ms: %d peer: %s server_uri: %s " << " peer: " << peer << " server_uri: " << server_uri
"failed: %s", << " failed: " << debug_string;
i, elapsed_ms, peer.c_str(), server_uri.c_str(),
debug_string.c_str());
total_failures++; total_failures++;
} else { } else {
gpr_log( LOG(INFO) << "soak iteration: " << i << " elapsed_ms: " << elapsed_ms
GPR_INFO, << " peer: " << peer << " server_uri: " << server_uri
"soak iteration: %d elapsed_ms: %d peer: %s server_uri: %s succeeded", << " succeeded";
i, elapsed_ms, peer.c_str(), server_uri.c_str());
} }
grpc_histogram_add(latencies_ms_histogram, std::get<1>(result)); grpc_histogram_add(latencies_ms_histogram, std::get<1>(result));
iterations_ran++; iterations_ran++;
@ -1277,48 +1258,40 @@ void InteropClient::PerformSoakTest(
double latency_ms_worst = grpc_histogram_maximum(latencies_ms_histogram); double latency_ms_worst = grpc_histogram_maximum(latencies_ms_histogram);
grpc_histogram_destroy(latencies_ms_histogram); grpc_histogram_destroy(latencies_ms_histogram);
if (iterations_ran < soak_iterations) { if (iterations_ran < soak_iterations) {
gpr_log( LOG(ERROR) << "(server_uri: " << server_uri << ") soak test consumed all "
GPR_ERROR, << overall_timeout_seconds
"(server_uri: %s) soak test consumed all %d seconds of time and quit " << " seconds of time and quit early, only having ran "
"early, only " << iterations_ran << " out of desired " << soak_iterations
"having ran %d out of desired %d iterations. " << " iterations. total_failures: " << total_failures
"total_failures: %d. " << ". max_failures_threshold: " << max_failures
"max_failures_threshold: %d. " << ". median_soak_iteration_latency: " << latency_ms_median
"median_soak_iteration_latency: %lf ms. " << " ms. 90th_soak_iteration_latency: " << latency_ms_90th
"90th_soak_iteration_latency: %lf ms. " << " ms. worst_soak_iteration_latency: " << latency_ms_worst
"worst_soak_iteration_latency: %lf ms. " << " ms. Some or all of the iterations that did run were "
"Some or all of the iterations that did run were unexpectedly slow. " "unexpectedly slow. See breakdown above for which iterations "
"See breakdown above for which iterations succeeded, failed, and " "succeeded, failed, and why for more info.";
"why for more info.",
server_uri.c_str(), overall_timeout_seconds, iterations_ran,
soak_iterations, total_failures, max_failures, latency_ms_median,
latency_ms_90th, latency_ms_worst);
CHECK(0); CHECK(0);
} else if (total_failures > max_failures) { } else if (total_failures > max_failures) {
gpr_log(GPR_ERROR, LOG(ERROR) << "(server_uri: " << server_uri
"(server_uri: %s) soak test ran: %d iterations. total_failures: %d " << ") soak test ran: " << soak_iterations
"exceeds " << " iterations. total_failures: " << total_failures
"max_failures_threshold: %d. " << " exceeds max_failures_threshold: " << max_failures
"median_soak_iteration_latency: %lf ms. " << ". median_soak_iteration_latency: " << latency_ms_median
"90th_soak_iteration_latency: %lf ms. " << " ms. 90th_soak_iteration_latency: " << latency_ms_90th
"worst_soak_iteration_latency: %lf ms. " << " ms. worst_soak_iteration_latency: " << latency_ms_worst
"See breakdown above for which iterations succeeded, failed, and " << " ms. See breakdown above for which iterations succeeded, "
"why for more info.", "failed, and why for more info.";
server_uri.c_str(), soak_iterations, total_failures, max_failures,
latency_ms_median, latency_ms_90th, latency_ms_worst);
CHECK(0); CHECK(0);
} else { } else {
gpr_log(GPR_INFO, LOG(INFO) << "(server_uri: " << server_uri
"(server_uri: %s) soak test ran: %d iterations. total_failures: %d " << ") soak test ran: " << soak_iterations
"is within " << " iterations. total_failures: " << total_failures
"max_failures_threshold: %d. " << " is within max_failures_threshold: " << max_failures
"median_soak_iteration_latency: %lf ms. " << ". median_soak_iteration_latency: " << latency_ms_median
"90th_soak_iteration_latency: %lf ms. " << " ms. 90th_soak_iteration_latency: " << latency_ms_90th
"worst_soak_iteration_latency: %lf ms. " << " ms. worst_soak_iteration_latency: " << latency_ms_worst
"See breakdown above for which iterations succeeded, failed, and " << " ms. See breakdown above for which iterations succeeded, "
"why for more info.", "failed, and why for more info.";
server_uri.c_str(), soak_iterations, total_failures, max_failures,
latency_ms_median, latency_ms_90th, latency_ms_worst);
} }
} }
@ -1327,14 +1300,14 @@ bool InteropClient::DoRpcSoakTest(
int32_t max_failures, int64_t max_acceptable_per_iteration_latency_ms, int32_t max_failures, int64_t max_acceptable_per_iteration_latency_ms,
int32_t soak_min_time_ms_between_rpcs, int32_t overall_timeout_seconds, int32_t soak_min_time_ms_between_rpcs, int32_t overall_timeout_seconds,
int32_t request_size, int32_t response_size) { int32_t request_size, int32_t response_size) {
gpr_log(GPR_DEBUG, "Sending %d RPCs...", soak_iterations); VLOG(2) << "Sending " << soak_iterations << " RPCs...";
CHECK_GT(soak_iterations, 0); CHECK_GT(soak_iterations, 0);
PerformSoakTest(server_uri, false /* reset channel per iteration */, PerformSoakTest(server_uri, false /* reset channel per iteration */,
soak_iterations, max_failures, soak_iterations, max_failures,
max_acceptable_per_iteration_latency_ms, max_acceptable_per_iteration_latency_ms,
soak_min_time_ms_between_rpcs, overall_timeout_seconds, soak_min_time_ms_between_rpcs, overall_timeout_seconds,
request_size, response_size); request_size, response_size);
gpr_log(GPR_DEBUG, "rpc_soak test done."); VLOG(2) << "rpc_soak test done.";
return true; return true;
} }
@ -1343,30 +1316,30 @@ bool InteropClient::DoChannelSoakTest(
int32_t max_failures, int64_t max_acceptable_per_iteration_latency_ms, int32_t max_failures, int64_t max_acceptable_per_iteration_latency_ms,
int32_t soak_min_time_ms_between_rpcs, int32_t overall_timeout_seconds, int32_t soak_min_time_ms_between_rpcs, int32_t overall_timeout_seconds,
int32_t request_size, int32_t response_size) { int32_t request_size, int32_t response_size) {
gpr_log(GPR_DEBUG, "Sending %d RPCs, tearing down the channel each time...", VLOG(2) << "Sending " << soak_iterations
soak_iterations); << " RPCs, tearing down the channel each time...";
CHECK_GT(soak_iterations, 0); CHECK_GT(soak_iterations, 0);
PerformSoakTest(server_uri, true /* reset channel per iteration */, PerformSoakTest(server_uri, true /* reset channel per iteration */,
soak_iterations, max_failures, soak_iterations, max_failures,
max_acceptable_per_iteration_latency_ms, max_acceptable_per_iteration_latency_ms,
soak_min_time_ms_between_rpcs, overall_timeout_seconds, soak_min_time_ms_between_rpcs, overall_timeout_seconds,
request_size, response_size); request_size, response_size);
gpr_log(GPR_DEBUG, "channel_soak test done."); VLOG(2) << "channel_soak test done.";
return true; return true;
} }
bool InteropClient::DoLongLivedChannelTest(int32_t soak_iterations, bool InteropClient::DoLongLivedChannelTest(int32_t soak_iterations,
int32_t iteration_interval) { int32_t iteration_interval) {
gpr_log(GPR_DEBUG, "Sending %d RPCs...", soak_iterations); VLOG(2) << "Sending " << soak_iterations << " RPCs...";
CHECK_GT(soak_iterations, 0); CHECK_GT(soak_iterations, 0);
CHECK_GT(iteration_interval, 0); CHECK_GT(iteration_interval, 0);
SimpleRequest request; SimpleRequest request;
SimpleResponse response; SimpleResponse response;
int num_failures = 0; int num_failures = 0;
for (int i = 0; i < soak_iterations; ++i) { for (int i = 0; i < soak_iterations; ++i) {
gpr_log(GPR_DEBUG, "Sending RPC number %d...", i); VLOG(2) << "Sending RPC number " << i << "...";
if (!PerformLargeUnary(&request, &response)) { if (!PerformLargeUnary(&request, &response)) {
gpr_log(GPR_ERROR, "Iteration %d failed.", i); LOG(ERROR) << "Iteration " << i << " failed.";
num_failures++; num_failures++;
} }
gpr_sleep_until( gpr_sleep_until(
@ -1374,17 +1347,17 @@ bool InteropClient::DoLongLivedChannelTest(int32_t soak_iterations,
gpr_time_from_seconds(iteration_interval, GPR_TIMESPAN))); gpr_time_from_seconds(iteration_interval, GPR_TIMESPAN)));
} }
if (num_failures == 0) { if (num_failures == 0) {
gpr_log(GPR_DEBUG, "long_lived_channel test done."); VLOG(2) << "long_lived_channel test done.";
return true; return true;
} else { } else {
gpr_log(GPR_DEBUG, "long_lived_channel test failed with %d rpc failures.", VLOG(2) << "long_lived_channel test failed with " << num_failures
num_failures); << " rpc failures.";
return false; return false;
} }
} }
bool InteropClient::DoUnimplementedService() { bool InteropClient::DoUnimplementedService() {
gpr_log(GPR_DEBUG, "Sending a request for an unimplemented service..."); VLOG(2) << "Sending a request for an unimplemented service...";
Empty request; Empty request;
Empty response; Empty response;
@ -1399,12 +1372,12 @@ bool InteropClient::DoUnimplementedService() {
return false; return false;
} }
gpr_log(GPR_DEBUG, "unimplemented service done."); VLOG(2) << "unimplemented service done.";
return true; return true;
} }
bool InteropClient::DoUnimplementedMethod() { bool InteropClient::DoUnimplementedMethod() {
gpr_log(GPR_DEBUG, "Sending a request for an unimplemented rpc..."); VLOG(2) << "Sending a request for an unimplemented rpc...";
Empty request; Empty request;
Empty response; Empty response;
@ -1418,7 +1391,7 @@ bool InteropClient::DoUnimplementedMethod() {
return false; return false;
} }
gpr_log(GPR_DEBUG, "unimplemented rpc done."); VLOG(2) << "unimplemented rpc done.";
return true; return true;
} }

Loading…
Cancel
Save