Skip to content

Add "drop samples with category" transform#5943

Open
canova wants to merge 1 commit intofirefox-devtools:mainfrom
canova:drop-category-transform
Open

Add "drop samples with category" transform#5943
canova wants to merge 1 commit intofirefox-devtools:mainfrom
canova:drop-category-transform

Conversation

@canova
Copy link
Copy Markdown
Member

@canova canova commented Apr 10, 2026

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.

@canova canova requested a review from mstange April 10, 2026 11:02
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 10, 2026

Codecov Report

❌ Patch coverage is 88.63636% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.39%. Comparing base (e17e396) to head (5ab25fb).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/profile-logic/transforms.ts 90.62% 3 Missing ⚠️
src/components/shared/CallNodeContextMenu.tsx 66.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5943   +/-   ##
=======================================
  Coverage   85.38%   85.39%           
=======================================
  Files         322      322           
  Lines       32101    32143   +42     
  Branches     8849     8860   +11     
=======================================
+ Hits        27410    27448   +38     
- Misses       4260     4263    +3     
- Partials      431      432    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mstange
Copy link
Copy Markdown
Contributor

mstange commented Apr 10, 2026

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
Copy link
Copy Markdown
Member Author

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.

@canova canova force-pushed the drop-category-transform branch from 049e78d to 3d480ef Compare April 10, 2026 15:56
@canova
Copy link
Copy Markdown
Member Author

canova commented Apr 10, 2026

I guess I was following how drop-function does, and it also drops the samples if any of the frame in the stack contains it. I updated the code to look at leaf only now. Is it better?

@canova canova force-pushed the drop-category-transform branch from 3d480ef to ccc3c7c Compare April 10, 2026 15:58
@mstange
Copy link
Copy Markdown
Contributor

mstange 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.

@canova canova force-pushed the drop-category-transform branch from ccc3c7c to b9dd201 Compare April 10, 2026 16:11
@canova
Copy link
Copy Markdown
Member Author

canova commented Apr 13, 2026

Yeah, I think it's a reasonable until we have something better.

@canova canova force-pushed the drop-category-transform branch from b9dd201 to 0ef4f32 Compare April 13, 2026 09:45
@canova canova marked this pull request as ready for review April 13, 2026 09:45
@canova canova requested a review from a team as a code owner April 13, 2026 09:45
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.
@canova canova force-pushed the drop-category-transform branch from 0ef4f32 to 5ab25fb Compare April 13, 2026 09:51
# This is used as the context menu item to apply the "Drop category" transform.
# Variables:
# $categoryName (String) - Name of the category to drop.
CallNodeContextMenu--transform-drop-category = Drop samples with category <strong>{ $categoryName }</strong>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a reason to use "Drop", vs something like "Ignore" or "Remove"?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We already have other "Drop ... " transforms, and I wanted to keep it consistent with the others. For example, we have two other transforms called: Drop samples with this function and Drop samples outside of markers matching .... So it was a natural choice to use drop here too.

Also, I think "remove" could be a bit ambiguous because several other transforms remove things. For example, we have "collapse" and "merge". That's another reason I preferred "drop".

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Makes sense.

@canova canova requested a review from flodolo April 13, 2026 19:26
# This is used as the context menu item to apply the "Drop category" transform.
# Variables:
# $categoryName (String) - Name of the category to drop.
CallNodeContextMenu--transform-drop-category = Drop samples with category <strong>{ $categoryName }</strong>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Makes sense.

# $item (String) - Name of the category that transform applied to.
TransformNavigator--focus-category = Focus category: { $item }

# "Drop samples with category" transform.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
# "Drop samples with category" transform.
# "Drop samples with category" transform (drop is a verb, as in remove)

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.

3 participants