builtin_service.md 2.87 KB
Newer Older
gejun's avatar
gejun committed
1 2
[中文版](../cn/builtin_service.md)

3
# Builtin Services
4

gejun's avatar
gejun committed
5 6 7
Builtin services expose internal status of servers in different pespectives, making development and debugging over brpc more efficient. brpc serves builting services via HTTP, which can be easily accessed through curl and web browsers. Servers respond plain text or html according to `User-Agent` in the request header, or you may append `?console=1` to the uri to force the server to respond in plain text. Check the [example](http://brpc.baidu.com:8765/) running on our dev machine(only accessible from Baidu internal) for more details. If the port is forbidden from where you run curl or web browser (e.g. not all ports are accessible from a web browser inside Baidu), you can use [rpc_view](rpc_view.md) for proxying.

Following 2 screenshots show accesses to builtin services from a web browser and a terminal respectively.  Note that the logo is the codename inside Baidu, and being modified to brpc in opensourced version.
8

gejun's avatar
gejun committed
9
**From a web browser**
10 11 12

![img](../images/builtin_service_more.png)

gejun's avatar
gejun committed
13
**From a terminal**
14

15
![img](../images/builtin_service_from_console.png)
16

gejun's avatar
gejun committed
17
# Security Mode
18

gejun's avatar
gejun committed
19
To avoid potential attacks and information leaks, builtin services **must** be hidden on servers that may be accessed from public, including the ones proxied by nginx or other http servers. Click [here](server.md#security-mode) for more details.
20

21
# Main services:
22

gejun's avatar
gejun committed
23
[/status](status.md): displays brief status of all services.
24

gejun's avatar
gejun committed
25
[/vars](vars.md): lists user-customizable counters on miscellaneous metrics.
26

gejun's avatar
gejun committed
27
[/connections](../cn/connections.md): lists all connections and their stats.
28

gejun's avatar
gejun committed
29
[/flags](../cn/flags.md): lists all gflags, some of them are modifiable at run-time.
30

gejun's avatar
gejun committed
31
[/rpcz](../cn/rpcz.md): traces all RPCs.
32

gejun's avatar
gejun committed
33
[cpu profiler](../cn/cpu_profiler.md): analyzes CPU hotspots.
34

gejun's avatar
gejun committed
35
[heap profiler](../cn/heap_profiler.md): shows how memory are allocated.
36

gejun's avatar
gejun committed
37
[contention profiler](../cn/contention_profiler.md): analyzes lock contentions.
38 39 40

# Other services

gejun's avatar
gejun committed
41
[/version](http://brpc.baidu.com:8765/version) shows version of the server. Call Server::set_version() to specify version of the server, or brpc would generate a default version like `brpc_server_<service-name1>_<service-name2> ...`
42 43 44

![img](../images/version_service.png)

gejun's avatar
gejun committed
45
[/health](http://brpc.baidu.com:8765/health) shows whether this server is alive or not.
46 47 48

![img](../images/health_service.png)

gejun's avatar
gejun committed
49
[/protobufs](http://brpc.baidu.com:8765/protobufs) shows scheme of all protobuf messages inside the server.
50 51 52

![img](../images/protobufs_service.png)

gejun's avatar
gejun committed
53
[/vlog](http://brpc.baidu.com:8765/vlog) shows all the [VLOG](streaming_log.md#VLOG) that can be enabled(not working with glog).
54 55 56

![img](../images/vlog_service.png)

gejun's avatar
gejun committed
57
/dir: browses all files on the server, convenient but too dangerous, disabled by default.
58

gejun's avatar
gejun committed
59
/threads: displays information of all threads of the process, hurting performance significantly when being turned on, disabled by default.