aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/qps/client_sync.cc
diff options
context:
space:
mode:
authorGravatar Vijay Pai <vpai@google.com>2017-02-21 13:17:41 -0800
committerGravatar Vijay Pai <vpai@google.com>2017-02-28 15:39:22 -0800
commit24992060c88dd93ac797b37fd077dd71239db655 (patch)
treea861b2633ef3f3489f2d9bfa2e733c9167555c59 /test/cpp/qps/client_sync.cc
parentcd232f64c634cba1e95b30db5d270114db6b1fc4 (diff)
Finish streams that error. Don't histogram failed ops.
Fail on failed write
Diffstat (limited to 'test/cpp/qps/client_sync.cc')
-rw-r--r--test/cpp/qps/client_sync.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc
index 498416c64a..a944c45496 100644
--- a/test/cpp/qps/client_sync.cc
+++ b/test/cpp/qps/client_sync.cc
@@ -129,7 +129,9 @@ class SynchronousUnaryClient final : public SynchronousClient {
grpc::ClientContext context;
grpc::Status s =
stub->UnaryCall(&context, request_, &responses_[thread_idx]);
- entry->set_value((UsageTimer::Now() - start) * 1e9);
+ if (s.ok()) {
+ entry->set_value((UsageTimer::Now() - start) * 1e9);
+ }
entry->set_status(s.error_code());
return true;
}
@@ -154,7 +156,7 @@ class SynchronousStreamingClient final : public SynchronousClient {
(*stream)->WritesDone();
Status s = (*stream)->Finish();
if (!s.ok()) {
- gpr_log(GPR_ERROR, "Stream %zu received an error %s", i,
+ gpr_log(GPR_ERROR, "Stream %" PRIuPTR " received an error %s", i,
s.error_message().c_str());
}
}
@@ -170,8 +172,17 @@ class SynchronousStreamingClient final : public SynchronousClient {
if (stream_[thread_idx]->Write(request_) &&
stream_[thread_idx]->Read(&responses_[thread_idx])) {
entry->set_value((UsageTimer::Now() - start) * 1e9);
+ // don't set the status since there isn't one yet
return true;
}
+ stream_[thread_idx]->WritesDone();
+ Status s = stream_[thread_idx]->Finish();
+ // don't set the value since the stream is failed and shouldn't be timed
+ entry->set_status(s.error_code());
+ if (!s.ok()) {
+ gpr_log(GPR_ERROR, "Stream %" PRIuPTR " received an error %s", thread_idx,
+ s.error_message().c_str());
+ }
auto* stub = channels_[thread_idx % channels_.size()].get_stub();
context_[thread_idx].~ClientContext();
new (&context_[thread_idx]) ClientContext();