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

*: Flamegraph data trimming #2299

Merged
merged 10 commits into from
Dec 22, 2022
Merged

*: Flamegraph data trimming #2299

merged 10 commits into from
Dec 22, 2022

Conversation

manojVivek
Copy link
Contributor

@manojVivek manojVivek commented Dec 15, 2022

  • Trimming nodes that are below the threshold
    - [ ] Garbage collect the values corresponding to the trimmed nodes from the tables

Fixes #2269

@@ -224,6 +224,9 @@ message QueryRequest {

// filter_query is the query string to filter the profile samples
optional string filter_query = 6;

// disable_trimming disables trimming of insignificant nodes in the report
optional bool disable_trimming = 7;
Copy link
Member

Choose a reason for hiding this comment

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

if we allow disabling it in the API at all, then I think we should allow passing the exact parameters to trim with

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah right, you mean the NodeCutOffFraction value, right?

Copy link
Member

Choose a reason for hiding this comment

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

correct

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is done.

Copy link
Member

Choose a reason for hiding this comment

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

What if we always set the node_trim_threshold in the UI and if it's unset (or the default value of 0.0) then it's disabled?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that sounds simpler. Will do that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is done.

@vercel
Copy link

vercel bot commented Dec 20, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
ui-documentation 🔄 Building (Inspect) Dec 20, 2022 at 8:39AM (UTC)

if len(graph.Root.Children) > 0 {
newTotal = children.Cumulative()
newDiff = children.Diff()
} else {
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand this else statement. If there are no children in the root node it should return 0 anyway, so this else should not be needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm. True, I was using this for the FlamegraphNode type where if there is no Children would mean leaf node and will have to take its own value. Sounds unnecessary for the Root node, will make it 0.

newTotal := int64(0)
newDiff := int64(0)
if len(graph.Root.Children) > 0 {
newTotal = children.Cumulative()
Copy link
Member

Choose a reason for hiding this comment

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

I think we should include the difference in cumulative due to node trimming in the proto response. I think it would be very confusing to click on a sample on a graph with let's say 100 CPU samples, and then only see 85 cumulative in the root node.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In that case, how do we account for the difference in the Child nodes? As the sum of child nodes would still only be 85 right?

Copy link
Member

Choose a reason for hiding this comment

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

Sorry I meant ultimately the UI should show something like "Showing 85 out of 100 samples"

Copy link
Member

Choose a reason for hiding this comment

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

So actually I meant that we should include the previous and trimmed total value in the response

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is samples the right terminology for all profile types?
Also would it be the right place to show this message or should we hide it under some i icon?

Screenshot 2022-12-21 at 12 01 21 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is done.

@@ -224,6 +224,9 @@ message QueryRequest {

// filter_query is the query string to filter the profile samples
optional string filter_query = 6;

// disable_trimming disables trimming of insignificant nodes in the report
optional bool disable_trimming = 7;
Copy link
Member

Choose a reason for hiding this comment

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

What if we always set the node_trim_threshold in the UI and if it's unset (or the default value of 0.0) then it's disabled?

// disable_trimming disables trimming of insignificant nodes in the report
optional bool disable_trimming = 7;

// node_trim_threshold is the threshold for trimming insignificant nodes in the report
Copy link
Member

Choose a reason for hiding this comment

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

From this comment it is unclear to me that this is a fraction or percentage. By this comment I would expect this to be a total value, which I don't think is true.

disabled={disabled}
/>
);
case 'number':
Copy link
Member

Choose a reason for hiding this comment

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

interesting idea, but I think this would break shareability, if you have a different configuration from me and you share a link with me I will see different data, if we expose this value (which I don't think we should today), then we should make it part of exploring the data (and therefore part of the URL)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah ok, and we can make this a value added to the URL whenever the user is in the ProfileExplorer and the query formed with the value from the URL taking higher precedence over the value from the preference so that the shareability is maintained.

But I would prefer moving this into a separate issue and implement it once #2115 is merged. As it has some nice utilities for dealing with the URL params state. Any concerns?

Copy link
Member

Choose a reason for hiding this comment

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

I would suggest then let's just use a hard-coded value for a start. (I'm not even sure it ever doesn't need to be)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried to see if I can implement the URL state without that PR, but it looks like a lot of duplicate work between these two. So, I'll hold it off.

So, if I understand it correctly, meanwhile, you would like this option removed from the user preference and work with just the hardcoded 0.005cut-off value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is done.

@manojVivek manojVivek merged commit 170aba3 into main Dec 22, 2022
@manojVivek manojVivek deleted the flamegraph-trimming branch December 22, 2022 09:41
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.

Trim the graph to eliminate stack traces that have insignificant value.
2 participants