| 137 | } |
| 138 | |
| 139 | void RpczService::stats(::google::protobuf::RpcController* cntl_base, |
| 140 | const ::brpc::RpczRequest*, |
| 141 | ::brpc::RpczResponse*, |
| 142 | ::google::protobuf::Closure* done) { |
| 143 | ClosureGuard done_guard(done); |
| 144 | Controller *cntl = static_cast<Controller*>(cntl_base); |
| 145 | cntl->http_response().set_content_type("text/plain"); |
| 146 | |
| 147 | if (!FLAGS_enable_rpcz && !has_span_db()) { |
| 148 | cntl->response_attachment().append( |
| 149 | "rpcz is not enabled yet. You can turn on/off rpcz by accessing " |
| 150 | "/rpcz/enable and /rpcz/disable respectively"); |
| 151 | return; |
| 152 | } |
| 153 | |
| 154 | butil::IOBufBuilder os; |
| 155 | DescribeSpanDB(os); |
| 156 | os.move_to(cntl->response_attachment()); |
| 157 | } |
| 158 | |
| 159 | inline void PrintRealTime(std::ostream& os, int64_t tm) { |
| 160 | char buf[16]; |