Skip to content
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

ft: Filter by function functionality added to ProfileView #2062

Merged
merged 12 commits into from
Nov 14, 2022

Conversation

manojVivek
Copy link
Contributor

No description provided.

@manojVivek manojVivek requested review from a team as code owners November 9, 2022 07:21
Copy link
Contributor

@monicawoj monicawoj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me! As mentioned on Discord, I'm working on the visualization top bar redesign, which may slightly shift some things around in terms of UI (which we can of course discuss), but the functionality looks on point!

Copy link
Member

@brancz brancz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this feature a lot! A few small comments, but I think we're very close!

@@ -196,6 +221,7 @@ func (q *ColumnQueryAPI) renderReport(ctx context.Context, p *profile.Profile, t
Report: &pb.QueryResponse_Top{Top: top},
}, nil
case pb.QueryRequest_REPORT_TYPE_CALLGRAPH:
fmt.Println("callgraph")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debugging leftover I assume?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, yes, my bad.

func filterProfileData(p *profile.Profile, filterQuery string) *profile.Profile {
filteredSamples := []*profile.SymbolizedSample{}
for _, s := range p.Samples {
var lines []profile.LocationLine
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to copy here. I would suggest the inside of this loop should be extracted to a separate function that's just called keepSample and if it returns true, then we append to filteredSamples. All the keepSample function then does is loop over all lines of all locations and on the first match it returns true and otherwise if no location line contained the search string, then it returns false.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Member

@brancz brancz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it! lgtm

@manojVivek manojVivek merged commit 9efbbdb into main Nov 14, 2022
@manojVivek manojVivek deleted the profile-search branch November 14, 2022 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants