-
Notifications
You must be signed in to change notification settings - Fork 540
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
Allow filtering trace details with search #7600
base: main
Are you sure you want to change the base?
Conversation
[ | ||
viewModel.Span.SpanId, | ||
GetResourceName(viewModel.Span.Source), | ||
SpanWaterfallViewModel.GetDisplaySummary(viewModel.Span), |
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.
Update GetDisplaySummary
on the VM to save the summary in a string so it isn't recreated when searched for and displayed on the page. e.g.
public static string GetDisplaySummary(OtlpSpan span)
{
return _cachedDisplaySummary ??= BuildDisplaySummary(span);
}
...
@@ -169,6 +207,11 @@ private void UpdateDetailViewData() | |||
return; | |||
} | |||
|
|||
private async Task HandleAfterFilterBindAsync() | |||
{ | |||
await InvokeAsync(_dataGrid.SafeRefreshDataAsync); |
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.
When you search on the resources and structured logs page, if there are open details then they're closed.
I can't remember exactly why we did that, but this page should also close details (if open) to be consistent.
@@ -93,6 +94,43 @@ private ValueTask<GridItemsProviderResult<SpanWaterfallViewModel>> GetData(GridI | |||
Items = page.ToList(), | |||
TotalItemCount = visibleSpanWaterfallViewModels.Count | |||
}); | |||
|
|||
// Return spans where any child span matches the filter. | |||
List<SpanWaterfallViewModel> GetFilteredSpanWaterfalls(List<SpanWaterfallViewModel> viewModels) |
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.
Could you split this method out from the page, maybe put it on SpanWaterfallViewModel
, and then write some unit tests for each scenario you mentioned on the page.
// Return spans where any child span matches the filter. | ||
List<SpanWaterfallViewModel> GetFilteredSpanWaterfalls(List<SpanWaterfallViewModel> viewModels) | ||
{ | ||
var viewModelsToFilterMatch = new Dictionary<SpanWaterfallViewModel, bool>(); |
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.
Is this a perf optimization to avoid filtering a span multiple times when there are children? Could you add a comment.
} | ||
|
||
matchesFilter = span.Children.Any(AnyChildMatchFilter) || Filter(_filter, span); | ||
viewModelsToFilterMatch.Add(span, matchesFilter); |
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.
Be defensive against a span show getting into the list multiple times to avoid a "key already exists" error.
viewModelsToFilterMatch.Add(span, matchesFilter); | |
viewModelsToFilterMatch.Add[span] = matchesFilter; |
return matchesFilter; | ||
} | ||
|
||
bool Filter(string filter, SpanWaterfallViewModel viewModel) |
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.
Could this be static?
IS this a 9.1 bug? |
Description
Adds a search button to the filter detail page that filters out spans based on the following rule:
A span is visible if any of these are true:
(no filter)
![image](https://private-user-images.githubusercontent.com/20359921/413031023-d85bb670-217d-4843-a07f-4a2002db3d1f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk5MzY4NzEsIm5iZiI6MTczOTkzNjU3MSwicGF0aCI6Ii8yMDM1OTkyMS80MTMwMzEwMjMtZDg1YmI2NzAtMjE3ZC00ODQzLWEwN2YtNGEyMDAyZGIzZDFmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE5VDAzNDI1MVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTE3NjEzZjZkNTc4OWFlMjhjMjM2ODJmNTJjNmZhNzA1ZDRhMDMzMGM0ZmIzNzYwYTM2MDdhODVkM2U4NTUzMmUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.T-ghvduIq8pZKNe1U6jtFnISIqyJaUiNluMFp7b1KIw)
(filter)
![image](https://private-user-images.githubusercontent.com/20359921/413030837-6c64953f-03c4-4e57-b0f3-cef91d62b6b7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk5MzY4NzEsIm5iZiI6MTczOTkzNjU3MSwicGF0aCI6Ii8yMDM1OTkyMS80MTMwMzA4MzctNmM2NDk1M2YtMDNjNC00ZTU3LWIwZjMtY2VmOTFkNjJiNmI3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE5VDAzNDI1MVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWExZGVmZjY0ZjdiMDRhYjNhMDUxOTViMjMzOWQwZDJkNGM0OWJhMDc5NDdkNzE3NDgwZTg5ZDJiMjlmYTliZjgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.-qRwyEW5IXvVI-2LspAmGRjYikAZvPfOGxD52aaXBQQ)
Fixes #4439
Checklist
<remarks />
and<code />
elements on your triple slash comments?breaking-change
template):doc-idea
template):