apache / apache/brpc

为什么brpc_metrics接口不返回服务的平均latency?

Open
#2,012 3 comments 0 reactions 0 assignees View on GitHub
feature
Dominant language
C++
Stars
17.6k
Forks
4.1k
Avg merge
2d 12h
Merged PRs (30d)
69

Description

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

最近在用brpc server,使用brpc_metrics将数据导入到prometheus上, 但发现没法获取平均latency, 看了代码
自定义的LatencyRecord在brpc_metrics下,能正常导出平均latency
而server默认的LatencyRecord在brpc_metrics下,不导出平均latency,取而代之的是导出avg_latency*count, 不知道这是出于什么原因?

**Describe the solution you'd like (描述你期望的解决方法)**
希望能按自定义的LatencyRecord一样导出

**Describe alternatives you've considered (描述你想到的折衷方案)**

**Additional context/screenshots (更多上下文/截图)**
有疑问的代码如图
![image](https://user-images.githubusercontent.com/25146253/203538629-ffe85965-96b3-43f7-a726-6f18c59c0b59.png)

Contributor guide

Open the contributing guide

Research direction

Start by reading the brpc_metrics code shown in the attached screenshot and compare how the server's default LatencyRecord is exported with the custom LatencyRecord. Confirm the current Prometheus output and define done as exposing the default service average latency in the requested form.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, prometheus
Domain
observability
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.