Rules UI show recording rules in wrong order

Issue Title: Rules UI Displays Recording Rules in Wrong Order

GitHub Repository: thanos-io/thanos

Reported By: caryjpaepen on 2023-05-12

Summary: The Rules UI within the Thanos project is incorrectly presenting the order of recording rules. Instead of displaying recording rules in the sequence they are evaluated (as defined in the YAML configuration), the UI sorts them alphabetically. This could mislead users into assuming that the evaluations occur in the order shown rather than the order specified in the configuration file.

Expected Behavior: The Rules UI should mimic the behavior of Prometheus, presenting recording rules in the order of their evaluation instead of alphanumerically.

Reproduction Steps:

  1. Define a rule group in YAML, for example:
groups:
- name: AGroup
interval: 30s
rules:
- record: good_events:rate_2m
expr: some_expression
- record: total_events:rate_2m
expr: some_expression
- record: good_events:rate_1h
expr: sum_over_time(good_events:rate_2m[60m])
  1. Navigate to the Rules UI and observe the displayed order of the recorded rules:
  • Current display:
  • record: good_events:rate_2m
  • record: good_events:rate_1h
  • record: total_events:rate_2m
  • Expected display should reflect the order they are defined in the YAML configuration.

Version Information: 0.29.0

Community Engagement: Multiple contributors have expressed interest in tackling this issue, with requests for assignments and guidance on implementation. Notably, contributors such as J0SAL, sadityakumar9211, achieverram28, and others have reached out for involvement.

Next Steps: The issue is labeled as “good first issue” and “help wanted,” inviting contributions to address the problem. Contributors are encouraged to submit pull requests based on their understanding of the requirements without needing formal assignment from maintainers.

Clarifications Requested: A participant has requested specific guidance regarding the exact location of the code that needs modification to resolve this issue. Further input from the initial reporter or maintainers may help streamline contributions.