Bug 1808394 - monitoring/query-browser doesn't honor order of returned metrics
Summary: monitoring/query-browser doesn't honor order of returned metrics
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Management Console
Version: 4.3.0
Hardware: All
OS: Linux
Target Milestone: ---
: 4.5.0
Assignee: Robb Hamilton
QA Contact: Yadan Pei
Depends On:
Blocks: 1808437
TreeView+ depends on / blocked
Reported: 2020-02-28 11:58 UTC by Aditya Konarde
Modified: 2020-07-13 17:22 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: The query browser results are rendered with a hard-coded sort. Consequence: The hard-coded sort can override the sort specified in the query, thus rendering a different result than requested. Fix: Remove the hard-coded sort so the sort specified in the query is preserved. Result: The results reflect the sort specified in the query.
Clone Of:
: 1808437 (view as bug list)
Last Closed: 2020-07-13 17:22:21 UTC
Target Upstream Version:

Attachments (Terms of Use)
Example query against the metrics browser (57.51 KB, image/png)
2020-02-28 11:58 UTC, Aditya Konarde
no flags Details
Data in Prometheus (413.90 KB, image/png)
2020-03-06 09:14 UTC, Yadan Pei
no flags Details
Data in Console (439.11 KB, image/png)
2020-03-06 09:14 UTC, Yadan Pei
no flags Details

System ID Priority Status Summary Last Updated
Github openshift console pull 4559 None closed Bug 1808394: remove default sorting from metrics table so query sort is prese… 2020-06-23 08:53:02 UTC
Red Hat Product Errata RHBA-2020:2409 None None None 2020-07-13 17:22:54 UTC

Description Aditya Konarde 2020-02-28 11:58:20 UTC
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

Comment 1 Robb Hamilton 2020-02-28 16:00:50 UTC
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).

Comment 4 Yadan Pei 2020-03-06 09:09:33 UTC
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

Comment 5 Yadan Pei 2020-03-06 09:14:10 UTC
Created attachment 1668027 [details]
Data in Prometheus

Comment 6 Yadan Pei 2020-03-06 09:14:49 UTC
Created attachment 1668028 [details]
Data in Console

Comment 8 errata-xmlrpc 2020-07-13 17:22:21 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.