Commit 3f46212e authored by zhujiashun's avatar zhujiashun

Add g_server_info_prefix

parent 8b4ac5a4
......@@ -22,7 +22,6 @@
#include "brpc/closure_guard.h" // ClosureGuard
#include "brpc/builtin/prometheus_metrics_service.h"
#include "brpc/builtin/common.h"
#include "brpc/details/server_private_accessor.h"
#include "bvar/bvar.h"
namespace bvar {
......@@ -33,6 +32,9 @@ DECLARE_int32(bvar_latency_p3);
namespace brpc {
// Defined in server.cpp
extern const char* const g_server_info_prefix;
// This is a class that convert bvar result to prometheus output.
// Currently the output only includes gauge and summary for two
// reasons:
......@@ -190,7 +192,7 @@ void PrometheusMetricsService::default_method(::google::protobuf::RpcController*
int DumpPrometheusMetricsToIOBuf(butil::IOBuf* output) {
butil::IOBufBuilder os;
PrometheusMetricsDumper dumper(&os, brpc::ServerPrivateAccessor::Prefix());
PrometheusMetricsDumper dumper(&os, g_server_info_prefix);
const int ndump = bvar::Variable::dump_exposed(&dumper, NULL);
if (ndump < 0) {
return -1;
......
......@@ -18,7 +18,6 @@
#define BRPC_PROMETHEUS_METRICS_SERVICE_H
#include "brpc/builtin_service.pb.h"
#include "brpc/server.h"
namespace brpc {
......
......@@ -22,7 +22,6 @@
#include "brpc/builtin/bad_method_service.h"
#include "brpc/restful.h"
namespace brpc {
// A wrapper to access some private methods/fields of `Server'
......@@ -98,8 +97,6 @@ public:
RestfulMap* global_restful_map() const
{ return _server->_global_restful_map; }
static std::string Prefix() { return Server::Prefix(); }
private:
const Server* _server;
};
......
......@@ -92,6 +92,8 @@ namespace brpc {
BAIDU_CASSERT(sizeof(int32_t) == sizeof(butil::subtle::Atomic32),
Atomic32_must_be_int32);
extern const char* const g_server_info_prefix = "rpc_server";
const char* status_str(Server::Status s) {
switch (s) {
case Server::UNINITIALIZED: return "UNINITIALIZED";
......@@ -265,10 +267,8 @@ static bvar::Vector<unsigned, 2> GetSessionLocalDataCount(void* arg) {
return v;
}
std::string Server::Prefix() { return "rpc_server"; }
std::string Server::ServerPrefix() const {
return butil::string_printf("%s_%d", Prefix().c_str(), listen_address().port);
return butil::string_printf("%s_%d", g_server_info_prefix, listen_address().port);
}
void* Server::UpdateDerivedVars(void* arg) {
......
......@@ -579,7 +579,6 @@ friend class Controller;
const ServiceProperty*
FindServicePropertyByName(const butil::StringPiece& name) const;
static std::string Prefix();
std::string ServerPrefix() const;
// Mapping from hostname to corresponding SSL_CTX
......
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