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

大盘panel使用排行榜但显示数量不对 #234

Open
lizhiyoumai opened this issue Jan 12, 2023 · 9 comments
Open

大盘panel使用排行榜但显示数量不对 #234

lizhiyoumai opened this issue Jan 12, 2023 · 9 comments

Comments

@lizhiyoumai
Copy link

sort_desc(topk(20,avg by (uri, method) ((sum(increase(http_server_requests_seconds_sum{application="$application",instance="$instance",uri!="root",method!="HEAD"}[1h])) by (uri, method))/(sum(increase(http_server_requests_seconds_count{application="$application",instance="$instance",uri!="root",method!="HEAD"}[1h])) by (uri, method) > 0)) * 1000)>0)
以上是我的图表的promql,想看top20的请求耗时,但是显示的排行榜里不止20条数据

@jsers
Copy link
Contributor

jsers commented Jan 12, 2023 via email

@lizhiyoumai
Copy link
Author

sort_desc(topk(20,avg by (uri, method) ((sum(increase(http_server_requests_seconds_sum{application="$application",instance="$instance",uri!="root",method!="HEAD"}[1h])) by (uri, method))/(sum(increase(http_server_requests_seconds_count{application="$application",instance="$instance",uri!="root",method!="HEAD"}[1h])) by (uri, method) > 0)) * 1000)>0)

我直接拿promql去prometheus查,查出来top20就是有20条结果,如下图:
image

查top22就有22条结果,如下:
image

@lizhiyoumai
Copy link
Author

补充一下,我如果选择的是时间序列图,topk数量也是对的上的

@jsers
Copy link
Contributor

jsers commented Jan 12, 2023 via email

@lizhiyoumai
Copy link
Author

什么意思?

@jsers
Copy link
Contributor

jsers commented Jan 12, 2023 via email

@jsers
Copy link
Contributor

jsers commented Jan 12, 2023

比如这个
image

@lizhiyoumai
Copy link
Author

那我怎么才能统计的准呢

@jsers jsers closed this as completed Feb 10, 2023
@jsers
Copy link
Contributor

jsers commented Feb 15, 2023

准备后面新增一个 Instant 开关,开启后会通过 query 接口查询数据,这样可以避免因为 query_range 返回的时间点不对齐导致无法获取期望的 topN 数据

@jsers jsers reopened this Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants