Skip to content

Implement marker filter menu and "drop samples outside of marker filter" transform#4631

Merged
canova merged 10 commits into
firefox-devtools:mainfrom
canova:filter-by-marker2
May 30, 2023
Merged

Implement marker filter menu and "drop samples outside of marker filter" transform#4631
canova merged 10 commits into
firefox-devtools:mainfrom
canova:filter-by-marker2

Conversation

@canova

@canova canova commented May 25, 2023

Copy link
Copy Markdown
Member

This is the successor of #4610, fixes #4590.

Deploy preview

After getting feedback from performance and sp3 people, we decided to implement this feature in a different way. I'm going to close the other PR in favor of this one.

Differently in this PR, we have a new "marker filters" menu on the right side of the search filter. When you click on that, a new context menu will appear and you will see the "Drop samples outside of filtered markers" context menu item.
When this is applied, you will be able to remove the samples that are outside of the filtered markers.

Here's the new "marker filter" button:
Screenshot 2023-05-25 at 3 00 18 PM

When you click on this button, this panel will pop up:
Screenshot 2023-05-25 at 3 02 34 PM

Implementation details:
First commit is unchanged, second commit is heavily changed but still similar to the initial version. And the rest is pretty much changed all together.

@canova canova requested a review from a team as a code owner May 25, 2023 13:05
@canova canova requested a review from julienw May 25, 2023 13:14
@codecov

codecov Bot commented May 25, 2023

Copy link
Copy Markdown

Codecov Report

Patch coverage: 67.64% and project coverage change: -0.13 ⚠️

Comparison is base (c3f2c3f) 88.61% compared to head (68fdc14) 88.49%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4631      +/-   ##
==========================================
- Coverage   88.61%   88.49%   -0.13%     
==========================================
  Files         294      295       +1     
  Lines       26095    26196     +101     
  Branches     7035     7062      +27     
==========================================
+ Hits        23125    23182      +57     
- Misses       2765     2805      +40     
- Partials      205      209       +4     
Impacted Files Coverage Δ
src/components/shared/CallNodeContextMenu.js 89.24% <0.00%> (-0.72%) ⬇️
src/selectors/per-thread/markers.js 93.63% <ø> (ø)
src/selectors/per-thread/stack-sample.js 96.96% <ø> (ø)
src/components/shared/MarkerSettings.js 52.17% <37.50%> (-33.55%) ⬇️
src/profile-logic/transforms.js 91.42% <57.14%> (-3.12%) ⬇️
src/components/shared/MarkerFiltersContextMenu.js 75.00% <75.00%> (ø)
src/selectors/per-thread/index.js 95.34% <100.00%> (+0.11%) ⬆️
src/selectors/per-thread/thread.js 94.81% <100.00%> (+0.07%) ⬆️
src/utils/flow.js 84.50% <100.00%> (+0.22%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@julienw julienw left a comment

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.

This looks pretty good to me! I don't have much to say :-) Thanks for working on this!

Comment on lines +51 to +59
const { isFilterMenuVisibleOnMouseDown } = this.state;
if (isFilterMenuVisibleOnMouseDown) {
// Do nothing as we would like to hide the menu if the menu was already visible on mouse down.
return;
}

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.

aaaah so that's what we should do for the track menu as well 😁

I wonder if we could be able to extract this for an easier reuse...
(not for now)

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.

Yeah, I was thinking about the track menu as well while doing this :) We can possibly extract it.

@mstange

mstange commented May 26, 2023

Copy link
Copy Markdown
Contributor

Could you add a dropdown arrow to the icon?

Also, I have the same problem with "filtered markers" as last time - does it mean "markers which match the filter" or "markers which have been filtered out"? How about "markers matching <...>"?

@canova

canova commented May 26, 2023

Copy link
Copy Markdown
Member Author

Thanks for the feedback! I added 2 new commits to add an arrow icon and make the wording more explicit. Please let me know what you think!

@julienw

julienw commented May 26, 2023

Copy link
Copy Markdown
Contributor

Thanks for the feedback! I added 2 new commits to add an arrow icon and make the wording more explicit. Please let me know what you think!

looks good to me

@mstange mstange left a comment

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.

Looks great, thank you!

@julienw julienw left a comment

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.

Some more comments to simplify this patch further. I hope this will be ok!

type StateProps = {|
+searchString: string,
+threadsKey: ThreadsKey,
+isMarkerFiltersMenuVisible: boolean,

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.

This isn't used in this component.

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.

Oh yeah, I think I added it while experimenting and then forgot. Removed it.

Comment on lines +37 to +44
_onShow = () => {
this.props.setMarkerFiltersMenuVisibility(true);
};

_onHide = () => {
this.props.setMarkerFiltersMenuVisibility(false);
};

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.

I've been thinking some more during the night (😴), I think it should be possible to just pass it on to the parent (add onShow / onHide props to MarkerFiltersContextMenuImpl, keep a local state in MarkerSettings) instead of using the redux state. We don't use this state elsewhere so it's better to keep it local IMO.
What do you think?

@canova canova May 30, 2023

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.

It works for me too. I initially wanted to keep that in the redux state thinking that we might need to change it in other places too, but this sounds simpler. I changed the code to keep that in local state.

canova added 10 commits May 30, 2023 13:15
…ransforms

Before the 'filter-samples' transform, we didn't need to get the
derived markers to be able to compute any thread related pre-thread
selectors. But with 'filter-samples' transform, we need to get the
derived markers to be able to compute the transform filtered thread
because this transform needs to find the markers that match the filter
and get the interval range out of them.

So because of this, I had to split the thread related selectors so we
can get the marker selectors in between them and have the marker
selectors in the second phase of thread selectors.

Previously the dependency graph was like this:

```
thread selectors
     |
     v
stack and sample
     +
marker selectors
     |
     v
composed selectors
```

Now it's like this:

```
basic thread selectors
       |
       v
marker selectors
       |
       v
rest of the thread selectors
       |
       v
stack and sample selectors
       |
       v
composed selectors
```

We can't put these thread selectors that require markers into the
`composed` selectors because stack and sample selectors require those
selectors earlier in the pipeline and I wanted to keep the thread
selectors still in their file to keep the pipeline in a single file.
@canova canova force-pushed the filter-by-marker2 branch from eacb3c7 to 68fdc14 Compare May 30, 2023 11:16
@canova canova merged commit 55bcf23 into firefox-devtools:main May 30, 2023
@canova canova deleted the filter-by-marker2 branch May 30, 2023 11:38
@canova canova mentioned this pull request May 30, 2023
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.

Ability to filter samples by marker name

4 participants