Too many results with topk function

647 views
Skip to first unread message

yongzhi yang

unread,
Jun 11, 2018, 6:57:28 AM6/11/18
to Prometheus Developers
Hi,
  I have a metric, its format as follow:
exnode_socket_status_estab_connection_count{endpoint="10.10.11.101",instance="192.168.90.116:19100",job="nodes"}

it's a gauge for the count of TCP connections,

if I query this metric with PromSQ : 
topk(10, exnode_socket_status_estab_connection_count)   

it return 10 entries:

exnode_socket_status_estab_connection_count{endpoint="all",instance="192.168.90.117:19100",job="nodes"}2118
exnode_socket_status_estab_connection_count{endpoint="all",instance="192.168.90.116:19100",job="nodes"}1977
exnode_socket_status_estab_connection_count{endpoint="all",instance="192.168.90.151:19100",job="nodes"}1946
exnode_socket_status_estab_connection_count{endpoint="all",instance="192.168.90.96:19100",job="nodes"}1900
exnode_socket_status_estab_connection_count{endpoint="all",instance="10.248.1.26:19100",job="nodes"}301
exnode_socket_status_estab_connection_count{endpoint="all",instance="10.248.1.27:19100",job="nodes"}246
exnode_socket_status_estab_connection_count{endpoint="all",instance="10.248.1.33:19100",job="nodes"}185
exnode_socket_status_estab_connection_count{endpoint="all",instance="10.248.1.55:19100",job="nodes"}185
exnode_socket_status_estab_connection_count{endpoint="10.253.1.6",instance="192.168.90.117:19100",job="nodes"}166
exnode_socket_status_estab_connection_count{endpoint="10.253.1.6",instance="192.168.90.96:19100",job="nodes"}
I think it is correct,
but let me see the Graph:



And I went to see it at grafana again, it was still like this:



Why is there extra entries?  
Thanks.


yongzhi yang

unread,
Jun 11, 2018, 7:01:02 AM6/11/18
to Prometheus Developers



在 2018年6月11日星期一 UTC+8下午6:57:28,yongzhi yang写道:

yongzhi yang

unread,
Jun 11, 2018, 7:15:08 AM6/11/18
to Prometheus Developers
The view of 'Query inspector' in grafana:


There is so much data via prometheus api in Grafana.
Why is the entry count  15 instead of 10?


Thanks. 

Tristan Colgate

unread,
Jun 11, 2018, 7:25:13 AM6/11/18
to yongzhi yang, Prometheus Developers
The topk applies to each individual step in the query, not the entire query as a whole, so at any given moment on that graph there will be 10 items, but across the entire graph there may be more, since each step may result in a different set of items.

--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
To post to this group, send email to prometheus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/30a6a817-b6bf-4898-857d-98ada3e33fb5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages