| 41 | void PutVarsHeading(std::ostream& os, bool expand_all); |
| 42 | |
| 43 | void StatusService::default_method(::google::protobuf::RpcController* cntl_base, |
| 44 | const ::brpc::StatusRequest*, |
| 45 | ::brpc::StatusResponse*, |
| 46 | ::google::protobuf::Closure* done) { |
| 47 | ClosureGuard done_guard(done); |
| 48 | Controller *cntl = static_cast<Controller*>(cntl_base); |
| 49 | const Server* server = cntl->server(); |
| 50 | const bool use_html = UseHTML(cntl->http_request()); |
| 51 | |
| 52 | // NOTE: the plain output also fits format of public/configure so that user |
| 53 | // can load values more easily. |
| 54 | cntl->http_response().set_content_type( |
| 55 | use_html ? "text/html" : "text/plain"); |
| 56 | butil::IOBufBuilder os; |
| 57 | std::string str; |
| 58 | if (use_html) { |
| 59 | os << "<!DOCTYPE html><html><head>\n" |
| 60 | "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n"; |
| 61 | bool expand = cntl->http_request().uri().GetQuery("expand"); |
| 62 | PutVarsHeading(os, expand); |
| 63 | os << "</head><body>"; |
| 64 | server->PrintTabsBody(os, "status"); |
| 65 | os << "<div class=\"layer1\">\n"; |
| 66 | } |
| 67 | os << "version: " << server->version() << '\n'; |
| 68 | |
| 69 | // non_service_error |
| 70 | if (use_html) { |
| 71 | os << "<p class=\"variable\">"; |
| 72 | } |
| 73 | os << "non_service_error: "; |
| 74 | if (use_html) { |
| 75 | os << "<span id=\"value-" << server->_nerror_bvar.name() << "\">"; |
| 76 | } |
| 77 | os << server->_nerror_bvar.get_value(); |
| 78 | if (use_html) { |
| 79 | os << "</span></p><div class=\"detail\"><div id=\"" << server->_nerror_bvar.name() |
| 80 | << "\" class=\"flot-placeholder\"></div></div>"; |
| 81 | } |
| 82 | os << '\n'; |
| 83 | |
| 84 | // connection_count |
| 85 | if (use_html) { |
| 86 | os << "<p class=\"variable\">"; |
| 87 | } |
| 88 | os << "connection_count: "; |
| 89 | if (use_html) { |
| 90 | os << "<span id=\"value-" << server->ServerPrefix() |
| 91 | << "_connection_count\">"; |
| 92 | } |
| 93 | ServerStatistics ss; |
| 94 | server->GetStat(&ss); |
| 95 | os << ss.connection_count; |
| 96 | if (use_html) { |
| 97 | os << "</span></p><div class=\"detail\"><div id=\"" |
| 98 | << server->ServerPrefix() |
| 99 | << "_connection_count\" class=\"flot-placeholder\"></div></div>"; |
| 100 | } |
nothing calls this directly
no test coverage detected