Skip to content

OU-481: use natural sort for label columns in metrics query table - #17565

Draft
etmurasaki wants to merge 1 commit into
openshift:release-4.14from
etmurasaki:OU-481-sort-metrics-dashboards
Draft

etmurasaki wants to merge 1 commit into
openshift:release-4.14from
etmurasaki:OU-481-sort-metrics-dashboards

Conversation

@etmurasaki

Copy link
Copy Markdown

Summary

  • Add naturalSort utility function in monitoring/utils.ts using localeCompare with numeric: true option
  • Update QueryTable sorting in metrics.tsx to use naturalSort for all label columns (keeps dedicated numeric sort for the Values column)

Problem

The metrics query table sorted label columns lexicographically, producing incorrect ordering for columns containing numeric values. For example, labels with values 1, 10, 2, 20 were sorted as 1, 10, 2, 20 instead of the expected 1, 2, 10, 20. Port numbers, memory values, CPU counts, and any other numeric data in query result labels were affected.

Fixes: #13543

This is the console release-4.14 backport. The same fix is in monitoring-plugin (openshift/monitoring-plugin#1462) for OCP 4.14+ with COO/CMO.

Test plan

  • Navigate to Observe → Metrics, run up query, click a label column header, verify port numbers sort numerically (9090, 9091, 9100 not 9090, 9100, 9091)
  • Verify alphabetic labels (job names, namespaces) still sort correctly
  • Verify both ascending and descending directions work in OCP 4.14 built-in console (without COO/CMO)

🤖 Generated with Claude Code

The metrics table sorted label columns lexicographically, causing incorrect
ordering for numeric values (e.g., 1, 10, 2, 20 instead of 1, 2, 10, 20).
Port numbers, memory values, and other numeric labels were affected.

Add a naturalSort utility that uses localeCompare with numeric:true so that
embedded numbers are compared by value, not by character code. Update the
QueryTable sorting to use naturalSort for all label columns while keeping
the dedicated numeric sort for the Values column.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification

This PR uses the pipeline controller for second-stage tests. Selection and triggering follow the repository configuration.

Use /test ? to list jobs and /pipeline help for commands.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Nov 23, 2026
@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 23, 2026
@openshift-ci-robot

openshift-ci-robot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

@etmurasaki: This pull request references OU-481 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target only the "4.14.z" version, but multiple target versions were set.

Details

In response to this:

Summary

  • Add naturalSort utility function in monitoring/utils.ts using localeCompare with numeric: true option
  • Update QueryTable sorting in metrics.tsx to use naturalSort for all label columns (keeps dedicated numeric sort for the Values column)

Problem

The metrics query table sorted label columns lexicographically, producing incorrect ordering for columns containing numeric values. For example, labels with values 1, 10, 2, 20 were sorted as 1, 10, 2, 20 instead of the expected 1, 2, 10, 20. Port numbers, memory values, CPU counts, and any other numeric data in query result labels were affected.

Fixes: #13543

This is the console release-4.14 backport. The same fix is in monitoring-plugin (openshift/monitoring-plugin#1462) for OCP 4.14+ with COO/CMO.

Test plan

  • Navigate to Observe → Metrics, run up query, click a label column header, verify port numbers sort numerically (9090, 9091, 9100 not 9090, 9100, 9091)
  • Verify alphabetic labels (job names, namespaces) still sort correctly
  • Verify both ascending and descending directions work in OCP 4.14 built-in console (without COO/CMO)

🤖 Generated with Claude Code

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci

openshift-ci Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@coderabbitai

coderabbitai Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Central YAML; Path: .coderabbit.yaml
  • Review profile: CHILL
  • Plan: Enterprise
  • Run ID: cdcf2821-f7dc-4057-aa7e-967e4feaeb22

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

@openshift-ci openshift-ci Bot added the component/core Related to console core functionality label Nov 23, 2026
@openshift-ci

openshift-ci Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign spadgett for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the component/monitoring Related to monitoring label Nov 23, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/core Related to console core functionality component/monitoring Related to monitoring do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants