Uh oh!
There was an error while loading. Please reload this page.
Add "drop samples with category" transform - #5943
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@## main #5943 +/- ##
==========================================
- Coverage 85.37% 85.34% -0.03%
==========================================
Files 322 322 Lines 32069 32159 +90 Branches 8814 8846 +32 ==========================================
+ Hits 27378 27446 +68 - Misses 4260 4281 +21 - Partials 431 432 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Hmm, in the deploy preview, if I drop samples with category JavaScript, it also drops samples with category DOM where the stack contains a JS function. |
canova
commented
Apr 10, 2026
Oh, I'm currently removing all the samples if they contain the category anywhere in their stack. It makes more sense to drop them if that category is the leaf only. |
049e78d to
3d480efComparecanova
commented
Apr 10, 2026
I guess I was following how |
3d480ef to
ccc3c7cComparemstange
commented
Apr 10, 2026
It's definitely more in line with my expectations. But now it's a bit confusing that you apply the filter by clicking a call node which will often still be there even with the filter applied. But maybe it's good enough. |
ccc3c7c to
b9dd201Comparecanova
commented
Apr 13, 2026
Yeah, I think it's a reasonable until we have something better. |
b9dd201 to
0ef4f32Compare0ef4f32 to
5ab25fbCompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
ba26f7b to
635e8e6CompareThis is useful for cases where I want to drop all the "idle" category samples, so I can focus on non-idle samples. Or it can be useful for dropping the whole profiler overhead by removing the "profiler" category. I would like to use this transform in the pq cli tool, so we can remove the idle category before finding the "top functions". Otherwise the idle category just pollutes the output of the cli a lot.
635e8e6 to
f202cbbComparemstange
commented
Apr 23, 2026
Hmm, it looks at the stack category after other transforms have been applied. Is that what we want? It might be... but look at this one for example: Here I've merged away the DOM stack nodes in two DOM samples and then dropped samples with category DOM. In the activity graph you can still see that those samples have "sample category" DOM - they're blue but not dropped. How do you feel about this? |
canova
commented
Apr 23, 2026
@mstange Hm that's a good question. I agree that it's confusing a bit. But I also feel like there is no perfect solution because I can also see another problem on the other option. Let's say that we changed this logic to always apply the drop-category transform on the non-filtered stacks. Then if I collapse a DOM category function (that contains non-DOM category leaf), and then apply this drop category transform, then we will continue seeing DOM category leafs in the flame graph. So the timeline will be correct, but this time the flame graph will look wrong. For example I prototyped the other solution and applied these changes:
So technically this had a "Other" category leaf at first. But now, I see that after I collapsed it and dropped "DOM", I still continue to see DOM leaf.
So to me it sounds like the question is "Where do we want to lie? Timeline or flame graph?" And I would probably chose timeline here as I would prefer to keep the flame graph the real source of truth as this is where the analysis happen. What do you think? I guess my initial implementation of dropping categories if they are anywhere in the stack (and not only in the leaf) would be kinda better as both the timeline and flame graph will have the same content. But again, probably that's not what we want either. |
mstange
commented
Apr 23, 2026
That's true. Tricky. I'm still leaning towards keeping it consistent with the time line - the disconnect is pre-existing, and the timeline is more closely-connected to "samples" rather than "stacks" than the flame graph is, and this is a "drop samples" transform. Part of the problem here is that the user initiates the transform from the flame graph / call tree and not from the activity graph or something outside the stack views. I would like to say "what you have is good enough, we'll fix it later" but then we may have to deal with broken links or complicated upgraders in the future... Another option would be to have an "Include idle samples" checkbox, and only show it if we have an Idle category. How would you feel about that? We've wanted an "Include off-cpu samples" checkbox (off-by-default) for a while, and I'm not sure how this would interact. Actually, maybe once we have an on/off-cpu flag per sample, we can upgrade profiles by looking at the Idle category, and then just rename the checkbox! What do you think? |
canova
commented
Apr 23, 2026
I think I like the idea of having a checkbox for including idle samples. Currently I wasn't super happy with the way I use this transform to drop idle frames in the cli. I think having something like this would make it easier there too. And it also makes sense for the future when we want to toggle off-cpu samples. I'll close this PR and will open up a new one with that. |
This is the approach we wanted to go with instead of #5943, also discussed there. This PR adds a new checkbox that's called "Include idle samples" to the settings of the call tree/flame graph/stack chart. It's visible only when we have an Idle category. It's checked by default in the web view, but can be unchecked to hide the idle samples. It will be unchecked by default in the profiler-cli though, as we think it's more important to be concise there. But it can be toggled there as well. [Here's a deploy preview](https://deploy-preview-5968--perf-html.netlify.app/public/p2fc32xj20c900rgyq8car76010v9gvc6995ab8/flame-graph/?globalTrackOrder=m0eafhlkijcb6g7w9d51w4&hiddenGlobalTracks=1w9bcgij&hiddenLocalTracksByPid=10715-1w3~10735-0~10741-0~10726-0~10723-0~10739-01~16424-0~16294-0~16367-0~14881-0~10725-0~13801-0w2~10924-0w3~10722-2~16395-0~10731-0~14104-0&range=3017m585&thread=s&v=15)

This is useful for cases where I want to drop all the "idle" category samples, so I can focus on non-idle samples. Or it can be useful for dropping the whole profiler overhead by removing the "profiler" category.
I would like to use this transform in the pq cli tool, so we can remove the idle category before finding the "top functions". Otherwise the idle category just pollutes the output of the cli a lot.
Example profile: deploy preview
Use the drop samples with category transform on the idle category above.