Skip to content

fix: added default order by for list queries#10870

Open
tushar-signoz wants to merge 1 commit intomainfrom
tvats-4538
Open

fix: added default order by for list queries#10870
tushar-signoz wants to merge 1 commit intomainfrom
tvats-4538

Conversation

@tushar-signoz
Copy link
Copy Markdown
Contributor

@tushar-signoz tushar-signoz commented Apr 7, 2026

Summary

  • Adds a default ORDER BY timestamp DESC for list/raw queries (logs, traces) in the QueryRange API handler when no explicit order is specified
  • This ensures that raw data listing endpoints (list views, exports, trace views) return results in a sensible newest-first order by default, rather than an undefined order

What changed

In pkg/querier/api.go, the QueryRange handler now calls queryRangeRequest.UseDefaultOrderBy() before executing the query. This method (already defined in querybuildertypesv5) applies a timestamp-descending default order to raw/list/trace request types when no order-by clause is present.

Test plan

  • Verify list queries for logs return results ordered by timestamp descending by default
  • Verify list queries for traces return results ordered by timestamp descending by default
  • Verify that queries with an explicit order-by are not affected
  • Verify aggregation/timeseries queries are not affected

🤖 Generated with Claude Code

@github-actions github-actions Bot added the bug Something isn't working label Apr 7, 2026
@tushar-signoz tushar-signoz self-assigned this Apr 7, 2026
@tushar-signoz tushar-signoz added the safe-to-integrate Run integration tests label Apr 7, 2026
@nityanandagohain
Copy link
Copy Markdown
Member

@tushar-signoz please fix the tests

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

Labels

bug Something isn't working safe-to-integrate Run integration tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants