Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign up/graph needs a way to select the "top 5" or similar #586
Comments
leonerd
changed the title
topk() does not play nicely on /graph
/graph needs a way to select the "top 5" or similar
Mar 9, 2015
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@discordianfish |
This comment has been minimized.
This comment has been minimized.
|
@juliusv Yes I understand that and topk makes sense as it. Still, having something similar to topk which returns the timeseries with the highest average value over the queried range would be super useful. I think it's a common thing to have dashboards with the top n of some things and with topk you get basically just garbage if the metrics are spiky. PS: This btw also happens if all timeseries are 0, in that case topk looks pretty random. Maybe we can improve that specific case easily? Guess we could look at the labels or something if the value is the same. |
This comment has been minimized.
This comment has been minimized.
thefallentree
commented
May 16, 2015
|
we can let user specify another time-range parameter (for example use last 5m to determine topK and show a 1day graph) / or even queries, use to determine the resulting timeseries to show on the graph. |
This comment has been minimized.
This comment has been minimized.
|
You could do things like
That would at each point display the top 5 metrics based on the average over the last 5m. That helps in some cases, but it's still not "fixed for exactly the displayed period, take the top5 metrics over that period". For that, we needed a way to select a fixed (not relative) time range in the expression language). |
This comment has been minimized.
This comment has been minimized.
|
I think this is something we should handle at the browser level rather than at the promql level as it doesn't quite fit the computational model. |
This comment has been minimized.
This comment has been minimized.
|
Being in the browser would be fine. The client-side rendering JS is probably in a better position to decide which are the "best" k series to plot anyway. |
brian-brazil
added
the
feature-request
label
Dec 16, 2015
This comment has been minimized.
This comment has been minimized.
or4cle
commented
Mar 17, 2016
|
+1 This would be a very useful to have. |
fabxc
added
kind/enhancement
and removed
feature request
labels
Apr 28, 2016
brian-brazil
referenced this issue
Jul 20, 2016
Closed
Internal plotting error for area plots within console templates #1837
This comment has been minimized.
This comment has been minimized.
|
I don't think we're ever going to do better here, the request is not compatible with the Prometheus evaluation model. |
brian-brazil
closed this
Feb 13, 2017
This comment has been minimized.
This comment has been minimized.
|
@brian-brazil What about supporting this client-side? Should we open a new issue for that? |
This comment has been minimized.
This comment has been minimized.
r4j4h
commented
May 16, 2017
|
Just wanted to mention some workarounds to achieve parts of what the OP wants that have gone unmentioned here: In Prometheus, the Table view presents only the "current" topk which should only be the k you entered. You can use offset to explore temporally. This should never show more records than the given k. If you are only wanting to see the history of the current topk, use the table view to grab the currents and then query not for the topk but for just those k records. IOTW, let's say you had Note also you could handle the "rest" in a similar way via negated regexp Since it hasn't been mentioned, even though it is an additional component, Grafana can do this quite easily as well. It can even happen accidentally on Panel types that prefer to only show "one" value if the dashboard designer isn't careful to use Prometheus' averaging functions and Grafana's "Current" value instead. To be clear I am not recommended re-opening this issue, just wanting to provide some other options for people. |
This comment has been minimized.
This comment has been minimized.
|
grafana/grafana#7664 will allow for this in Grafana |
This comment has been minimized.
This comment has been minimized.
fho
commented
Sep 28, 2017
|
@brian-brazil how can I create graph showing only the top X by label with using the In my case I have a metric called If I make a query like |
simonpasquier
pushed a commit
to simonpasquier/prometheus
that referenced
this issue
Oct 12, 2017
This comment has been minimized.
This comment has been minimized.
|
This is possible in Grafana 5.3.0: https://www.robustperception.io/graph-top-n-time-series-in-grafana |
leonerd commentedMar 9, 2015
I have a timeseries with about 40 or so values for a label. I want to show a graph of the top 5 of them. If I simply plot
topk(5, ...)
then this picks the top five for each time in the graph, resulting in at most 5 non-zero lines per vertical slice of time, but there's still around 30 or so plots overall.
Instead, the selection of the "top five" needs to be done after the entire set of values is collected ready for display by the graph generator. It would have to be an argument to the graph generator itself.
Additionally, it would be really nice if the remaining buckets could be summed into an "everything else" plot, so that I could draw a stacked area graph showing the top 5 in the time period, and all the rest as one final area, so that the total is still representative.