Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
brpc
Commits
3f46212e
Commit
3f46212e
authored
Jun 18, 2019
by
zhujiashun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add g_server_info_prefix
parent
8b4ac5a4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
10 deletions
+7
-10
prometheus_metrics_service.cpp
src/brpc/builtin/prometheus_metrics_service.cpp
+4
-2
prometheus_metrics_service.h
src/brpc/builtin/prometheus_metrics_service.h
+0
-1
server_private_accessor.h
src/brpc/details/server_private_accessor.h
+0
-3
server.cpp
src/brpc/server.cpp
+3
-3
server.h
src/brpc/server.h
+0
-1
No files found.
src/brpc/builtin/prometheus_metrics_service.cpp
View file @
3f46212e
...
...
@@ -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
;
...
...
src/brpc/builtin/prometheus_metrics_service.h
View file @
3f46212e
...
...
@@ -18,7 +18,6 @@
#define BRPC_PROMETHEUS_METRICS_SERVICE_H
#include "brpc/builtin_service.pb.h"
#include "brpc/server.h"
namespace
brpc
{
...
...
src/brpc/details/server_private_accessor.h
View file @
3f46212e
...
...
@@ -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
;
};
...
...
src/brpc/server.cpp
View file @
3f46212e
...
...
@@ -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
)
{
...
...
src/brpc/server.h
View file @
3f46212e
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment