Commit 16b9bc78 authored by zhujiashun's avatar zhujiashun

Make ServerPrivateAccessor::Prefix static

parent 81c8e7f2
...@@ -190,7 +190,7 @@ void PrometheusMetricsService::default_method(::google::protobuf::RpcController* ...@@ -190,7 +190,7 @@ void PrometheusMetricsService::default_method(::google::protobuf::RpcController*
int DumpPrometheusMetricsToIOBuf(butil::IOBuf* output) { int DumpPrometheusMetricsToIOBuf(butil::IOBuf* output) {
butil::IOBufBuilder os; butil::IOBufBuilder os;
PrometheusMetricsDumper dumper(&os, brpc::ServerPrivateAccessor(NULL).Prefix()); PrometheusMetricsDumper dumper(&os, brpc::ServerPrivateAccessor::Prefix());
const int ndump = bvar::Variable::dump_exposed(&dumper, NULL); const int ndump = bvar::Variable::dump_exposed(&dumper, NULL);
if (ndump < 0) { if (ndump < 0) {
return -1; return -1;
......
...@@ -30,6 +30,7 @@ namespace brpc { ...@@ -30,6 +30,7 @@ namespace brpc {
class ServerPrivateAccessor { class ServerPrivateAccessor {
public: public:
explicit ServerPrivateAccessor(const Server* svr) { explicit ServerPrivateAccessor(const Server* svr) {
CHECK(svr);
_server = svr; _server = svr;
} }
...@@ -97,7 +98,7 @@ public: ...@@ -97,7 +98,7 @@ public:
RestfulMap* global_restful_map() const RestfulMap* global_restful_map() const
{ return _server->_global_restful_map; } { return _server->_global_restful_map; }
std::string Prefix() const { return Server::Prefix(); } static std::string Prefix() { return Server::Prefix(); }
private: private:
const Server* _server; const Server* _server;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment