Optimize trace detail page performance#10308
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR optimizes the trace detail page performance by preventing unnecessary updates when other traces are modified. The optimization adds a check to compare the span count of the currently viewed trace before updating the UI, only refreshing when the trace has actually changed.
Key changes:
- Added span count comparison to avoid unnecessary UI updates when other traces change
- Refactored trace retrieval into a separate method for reusability
- Added comprehensive tests to verify both update and non-update scenarios
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/Aspire.Dashboard/Components/Pages/TraceDetail.razor.cs |
Added optimization logic to check trace changes before UI updates and extracted GetTrace method |
tests/Aspire.Dashboard.Components.Tests/Pages/TraceDetailsTests.cs |
Added test coverage for trace update scenarios and logging verification |
Contributor
|
Is this for 9.4? |
Member
Author
|
No |
7e29424 to
8c56808
Compare
adamint
approved these changes
Jul 15, 2025
8c56808 to
b5bffc0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Trace detail page is updated when new trace data is received. This is so the currently viewed trace is updated with new spans.
However a lot of the time it is unnessary. Other traces are being updated, but the trace detail page is still updated with unchanged data. This PR adds a check to see whether the currently viewed trace has changed or not and skips updating the page if it hasn't.
Checklist
<remarks />and<code />elements on your triple slash comments?doc-ideatemplatebreaking-changetemplatediagnostictemplate