Skip to content

Commit

Permalink
Set Timeout and elapsed time in same units (#2826)
Browse files Browse the repository at this point in the history
The elasped time is in micros-seconds and
timeout is in milliseconds for endpoint /rpcz

Set elasped time to milliseconds.
  • Loading branch information
srivignessh authored and bmatican committed Nov 13, 2019
1 parent e5b35ce commit 87962cc
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/yb/rpc/outbound_call.cc
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ bool OutboundCall::DumpPB(const DumpRunningRpcsRequestPB& req,
RpcCallInProgressPB* resp) {
std::lock_guard<simple_spinlock> l(lock_);
InitHeader(resp->mutable_header());
resp->set_micros_elapsed(MonoTime::Now().GetDeltaSince(start_).ToMicroseconds());
resp->set_elapsed_millis(MonoTime::Now().GetDeltaSince(start_).ToMilliseconds());
resp->set_state(state());
if (req.include_traces() && trace_) {
resp->set_trace_buffer(trace_->DumpToString(true));
Expand Down
2 changes: 1 addition & 1 deletion src/yb/rpc/rpc_introspection.proto
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ enum RpcCallState {
message RpcCallInProgressPB {
required RequestHeader header = 1;
optional string trace_buffer = 2;
optional uint64 micros_elapsed = 3;
optional uint64 elapsed_millis = 3;
optional uint64 sending_bytes = 6;
optional RpcCallState state = 7;
oneof call_details {
Expand Down
4 changes: 2 additions & 2 deletions src/yb/rpc/rpc_stub-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ TEST_F(RpcStubTest, TestDumpCallsInFlight) {
ASSERT_EQ(1, dump_resp.outbound_connections(0).calls_in_flight_size());
ASSERT_EQ("Sleep", dump_resp.outbound_connections(0).calls_in_flight(0).
header().remote_method().method_name());
ASSERT_GT(dump_resp.outbound_connections(0).calls_in_flight(0).micros_elapsed(), 0);
ASSERT_GT(dump_resp.outbound_connections(0).calls_in_flight(0).elapsed_millis(), 0);

// And the server messenger.
// We have to loop this until we find a result since the actual call is sent
Expand All @@ -569,7 +569,7 @@ TEST_F(RpcStubTest, TestDumpCallsInFlight) {
ASSERT_EQ(1, dump_resp.inbound_connections(0).calls_in_flight_size());
ASSERT_EQ("Sleep", dump_resp.inbound_connections(0).calls_in_flight(0).
header().remote_method().method_name());
ASSERT_GT(dump_resp.inbound_connections(0).calls_in_flight(0).micros_elapsed(), 0);
ASSERT_GT(dump_resp.inbound_connections(0).calls_in_flight(0).elapsed_millis(), 0);
ASSERT_STR_CONTAINS(dump_resp.inbound_connections(0).calls_in_flight(0).trace_buffer(),
"Inserting onto call queue");
latch.Wait();
Expand Down
4 changes: 2 additions & 2 deletions src/yb/rpc/yb_rpc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,8 @@ bool YBInboundCall::DumpPB(const DumpRunningRpcsRequestPB& req,
if (req.include_traces() && trace_) {
resp->set_trace_buffer(trace_->DumpToString(true));
}
resp->set_micros_elapsed(MonoTime::Now().GetDeltaSince(timing_.time_received)
.ToMicroseconds());
resp->set_elapsed_millis(MonoTime::Now().GetDeltaSince(timing_.time_received)
.ToMilliseconds());
return true;
}

Expand Down
4 changes: 2 additions & 2 deletions src/yb/yql/cql/cqlserver/cql_rpc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,8 @@ bool CQLInboundCall::DumpPB(const rpc::DumpRunningRpcsRequestPB& req,
if (req.include_traces() && trace_) {
resp->set_trace_buffer(trace_->DumpToString(true));
}
resp->set_micros_elapsed(
MonoTime::Now().GetDeltaSince(timing_.time_received).ToMicroseconds());
resp->set_elapsed_millis(
MonoTime::Now().GetDeltaSince(timing_.time_received).ToMilliseconds());
GetCallDetails(resp);

return true;
Expand Down
4 changes: 2 additions & 2 deletions src/yb/yql/redis/redisserver/redis_rpc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,8 @@ bool RedisInboundCall::DumpPB(const rpc::DumpRunningRpcsRequestPB& req,
if (req.include_traces() && trace_) {
resp->set_trace_buffer(trace_->DumpToString(true));
}
resp->set_micros_elapsed(MonoTime::Now().GetDeltaSince(timing_.time_received)
.ToMicroseconds());
resp->set_elapsed_millis(MonoTime::Now().GetDeltaSince(timing_.time_received)
.ToMilliseconds());

if (!parsed_.load(std::memory_order_acquire)) {
return true;
Expand Down

0 comments on commit 87962cc

Please sign in to comment.