Created attachment 1666379 [details] Example query against the metrics browser Description of problem: The query browser UI on the OpenShift console doesn't honor the order of returned metrics. Version-Release number of selected component (if applicable): OpenShift 4.3.0 How reproducible: Always Steps to Reproduce: 1.Go to the Monitoring query browser on the OpenShift console 2.Run a query that includes sorting, for example use the sort_desc function (see attachment) Actual results: The returned list of metrics is not sorted Expected results: If using a query where the order of returned metrics makes sense, the returned list of metrics should be sorted accordingly
This bug appears to be the result of the fact that the console manipulates the data for display purposes. By comparison, Prometheus simply displays the data as it is returned. Further, the console allows the user to change the sort column and sort direction via the table column headers (Prometheus does not), which provides another opportunity for the data display to differ from the query. Andy, can you shed light on the reasoning for the differences between the console implementation and that of Prometheus? It seems the simplest approach to fixing the bug is to simply follow what Prometheus does (display the data exactly as it is returned).
Try to run this query `sort_desc(topk(100,sum(pod:container_cpu_usage:sum)by(namespace)))` in prometheus and openshift console Monitoring -> Metrics console just show the data as it is returned(in prometheus UI, when use sort_desc function, data returned is in order), user can sort data by Namespace & Value anyway. Verified on 4.5.0-0.ci-2020-03-04-223611
Created attachment 1668027 [details] Data in Prometheus
Created attachment 1668028 [details] Data in Console
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2020:2409