apache / brpc

brpc is an Industrial-grade RPC framework using C++ Language, which is often used in high performance system such as Search, Storage, Machine learning, Advertisement, Recommendation etc. "brpc" means "better RPC".
https://brpc.apache.org
Apache License 2.0
16.56k stars 3.98k forks source link

brpc的brpc_metrics的输出格式与prometheus的标准不符,尤其MultiDimension<bvar::LatencyRecorder>方式 #2825

Open xinhua5 opened 8 hours ago

xinhua5 commented 8 hours ago

Is your feature request related to a problem? (你需要的功能是否与某个问题有关?)

使用MultiDimension 自定义了监控埋点,输出之后看到的结果是这样的:

# TYPE server_latency{db_id="112",shard_id="2",method="fetch",stage="next",quantile="80"} gauge server_latency{db_id="112",shard_id="2",method="fetch",stage="next",quantile="80"} 4076 # HELP server_latency{db_id="112",shard_id="2",method="fetch",stage="next",quantile="90"} # TYPE server_latency{db_id="112",shard_id="2",method="fetch",stage="next",quantile="90"} gauge server_latency{db_id="112",shard_id="2",method="fetch",stage="next",quantile="90"} 5185 # HELP server_latency{db_id="112",shard_id="2",method="fetch",stage="next",quantile="99"} # TYPE server_latency{db_id="112",shard_id="2",method="fetch",stage="next",quantile="99"} gauge server_latency{db_id="112",shard_id="2",method="fetch",stage="next",quantile="99"} 5185 # HELP server_latency{db_id="112",shard_id="2",method="fetch",stage="next",quantile="999"} # TYPE server_latency{db_id="112",shard_id="2",method="fetch",stage="next",quantile="999"} gauge server_latency{db_id="112",shard_id="2",method="fetch",stage="next",quantile="999"} 5185 # HELP server_latency{db_id="112",shard_id="2",method="fetch",stage="next",quantile="9999"} # TYPE server_latency{db_id="112",shard_id="2",method="fetch",stage="next",quantile="9999"} gauge server_latency{db_id="112",shard_id="2",method="fetch",stage="next",quantile="9999"} 5185

Describe the solution you'd like (描述你期望的解决方法)

prometheus期望的格式是这样的:

# HELP server_latency Latency of zbase server operations
# TYPE server_latency gauge
server_latency{db_id="112",shard_id="1",method="fetch",stage="next",quantile="99"} 2816
server_latency{db_id="112",shard_id="1",method="fetch",stage="next",quantile="999"} 2816
server_latency{db_id="112",shard_id="1",method="fetch",stage="next",quantile="9999"} 2816
server_latency{db_id="112",shard_id="2",method="fetch",stage="next"} 2729
server_latency{db_id="112",shard_id="2",method="fetch",stage="next",quantile="80"} 4076
server_latency{db_id="112",shard_id="2",method="fetch",stage="next",quantile="90"} 5185
server_latency{db_id="112",shard_id="2",method="fetch",stage="next",quantile="99"} 5185

Describe alternatives you've considered (描述你想到的折衷方案) brpc是否可以把brpc_metrics的输出格式转化为 metrics + lables 的模式

Additional context/screenshots (更多上下文/截图)