-
Notifications
You must be signed in to change notification settings - Fork 772
Allow sorting by timestamp in structured logs and traces #8331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds sorting functionality by timestamp for both traces and structured logs. Key changes include new tests for sorting, updates to API context objects and helper methods to accept a sort function, and UI component adjustments to enable sortable columns.
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Aspire.Dashboard.Tests/TelemetryRepositoryTests/TraceTests.cs | Added tests to validate trace sorting and subset selection |
| tests/Aspire.Dashboard.Tests/TelemetryRepositoryTests/LogTests.cs | Added tests to validate log sorting and subset selection |
| src/Aspire.Dashboard/Components/Pages/StructuredLogs.razor.cs | Updated log page to use sortable columns with a new GridSort instance |
| src/Aspire.Dashboard/Otlp/Storage/GetLogsContext.cs | Extended context with a new SortFunction property |
| src/Aspire.Dashboard/Otlp/Model/OtlpHelpers.cs | Modified GetItems overloads to support sorting |
| src/Aspire.Dashboard/Components/Pages/Traces.razor.cs | Updated traces page to use sortable columns with a new GridSort instance |
| src/Aspire.Dashboard/Model/TracesViewModel.cs | Updated GetTraces method to accept a sort function |
| src/Aspire.Dashboard/Model/StructuredLogsViewModel.cs | Updated GetLogs method to accept a sort function |
| src/Aspire.Dashboard/Otlp/Storage/TelemetryRepository.cs | Enhanced GetLogs/GetTraces to propagate sort functions; issues with parameter order in GetLogs call |
| src/Aspire.Dashboard/Components/Pages/StructuredLogs.razor | Enabled sorting on the timestamp column |
| src/Aspire.Dashboard/Components/Pages/Traces.razor | Enabled sorting on the timestamp column |
|
A problem with sorting in this direction: If you're not scrolled to bottom, new logs or traces will push what you're currently viewing off the page. Ideally the grid would keep position. In other words, as new items were added to the grid, the scrollbar would update to keep the currently viewed items on the screen. Example of the problem: Pausing collection is a work around. But it's not a good experience without pausing. |
So, dependent on #8184? |
|
Or do we also stop the page from scrolling |
|
Investigate what is involved to keep position. This must be a common problem with examples of solutions. I don't think this needs to be in 9.2. |
|
Reached out to Vincent for advice. |
|
We don't have any good ways of maintaining or changing scroll positions in the DataGrid, I'm afraid... |
|
closing stale PR's. this seems like it needs more design work if we do it. |


Description
Adds the ability to sort by timestamp for traces and structured logs. For this, I had to extend
OtlpHelpers.GetItemsto also accept a sorting function as is provided to us inGetDatain the data grids.Fixes #4190
Checklist
<remarks />and<code />elements on your triple slash comments?breaking-changetemplate):doc-ideatemplate):