Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mbvar 如何通过 LatencyRecorder 获取平均耗时 #2660

Open
renzhong opened this issue Jun 5, 2024 · 2 comments
Open

mbvar 如何通过 LatencyRecorder 获取平均耗时 #2660

renzhong opened this issue Jun 5, 2024 · 2 comments
Labels
bug the code does not work as expected

Comments

@renzhong
Copy link
Contributor

renzhong commented Jun 5, 2024

Describe the bug (描述bug)
mbvar 的 prometheus 的上报格式如下:
service_latency{valid="false"} 0
service_latency{valid="false",quantile="80"} 0
service_latency{valid="false",quantile="90"} 0
service_latency{valid="false",quantile="99"} 0
service_latency{valid="false",quantile="999"} 0
service_latency{valid="false",quantile="9999"} 0
service_max_latency{valid="false"} 0
service_qps{valid="false"} 0
service_count{valid="false"} 1
此时没办法通过:avg(service_latency{valid="false"}) 来获取平均耗时,因为 avg 会把所有 service_latency 求平均,包括了 p99等数值。
而 bvar 的 LatencyRecorder 通过拆分名字 latency/latency_99 避免了平均耗时的求 avg 的问题。这应该是 mbvar 的 bug 吧,没办法统计平均耗时了

To Reproduce (复现方法)

Expected behavior (期望行为)

Versions (各种版本)
OS:
Compiler:
brpc:
protobuf:

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

@wwbmmm wwbmmm added the bug the code does not work as expected label Jun 10, 2024
@renzhong
Copy link
Contributor Author

我准备修复这个问题,有两个方案,一个是参考 bvar,拆分名字。一个是把平均耗时改成 service_latency{valid="false",quantile='avg'} 0
这两种方案,哪种更好一些? @wwbmmm

@wwbmmm
Copy link
Contributor

wwbmmm commented Jun 13, 2024

百度内部好像是用的 service_latency{valid="false",quantile="avg"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug the code does not work as expected
Projects
None yet
Development

No branches or pull requests

2 participants