Add a transform to filter samples by marker name#4610
Conversation
68d5b71 to
7ff0a57
Compare
| # It filters the samples by the marker name. | ||
| # Variables: | ||
| # $markerName (String) - Name of the marker that is selected. | ||
| MarkerContextMenu--filter-samples-by-marker-name = Filter samples by “<strong>{ $markerName }</strong>” markers |
There was a problem hiding this comment.
Is it just me or this could read better with with? Also, plural or singular marker?
Filter samples with “<strong>{ $markerName }</strong>” marker
There was a problem hiding this comment.
Good question, I wasn't sure which one was best but I found this answer: https://english.stackexchange.com/a/392465
It says:
To choose either 'by' or 'with', you need to see if the phrase/word that comes next indicates a method or an instrument. If you want to show a method, you use by. If it's an instrument with which the activity was done, you use with
And here's the part that fits our example:
In your case, 'names' are a method used for filtering users list, not an instrument. So, you have to use 'by'. See the examples below:
I want to filter the users list by names
So I think it's "by", but this is only one answer and it could be wrong. Happy to get more feedback from other people.
For plurality, I chose the plural "markers" because there could be multiple markers with the same name and we account all the markers with that name while filtering.
There was a problem hiding this comment.
After talking about this in the matrix channel, I've thought a bit about this and decided to use Filter samples within “{ $markerName }” markers (even though I was opposed to it at first :) )
I wanted to use it because I really wanted a one word alternative to the others.
The closes ones I was considering were Filter samples taken during "{ $markerName }" markers and Filter samples overlapping with “{ $markerName }” markers but I felt like they are long.
Let me know what you think!
f017857 to
cb0d410
Compare
a1570d0 to
8741c07
Compare
…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.
julienw
left a comment
There was a problem hiding this comment.
Thanks, this seems to work very well!
I left a few comments, but my main concern is how we serialize the transform to the URL, that we could use the stringIndex for the marker name. Tell me what you think!
| } | ||
|
|
||
| .markerContextMenuIconFilterSamples { | ||
| background-image: url(firefox-profiler-res/img/svg/filter.svg); |
There was a problem hiding this comment.
It doesn't look great when the line is selected. Maybe try to invert it on hover (see below). Otherwise we may need to tweak it so that it doesn't have an alpha layer anymore.
Also I'm not sure this is the best icon, I don't see how it relates to droping or markers. But we can change it later so let's not focus on this. Or maybe we can just reuse the icon we use for "drop samples"? Indeed we're not in the same context menu.
There was a problem hiding this comment.
Yeah, I'm not super happy about the icon but that's the only one I could find. I didn't want to use "drop function" icon because that uses the tree visualization to convey the meaning which is correct since we apply this to call tree. But we drop samples directly here. But maybe that's fine?
Here's how it looks with the inverter colors, what do you think?:

| name: 'measure-2', | ||
| entryType: 'measure', | ||
| }, | ||
| ], |
There was a problem hiding this comment.
optional: these markers do not look exactly like real profiles, because the name should probably be DOMEvent for dom events, and UserTiming for user timing markers. Then of course you'd have to find another marker type for Marker B so that it's different than the other UserTiming.
There was a problem hiding this comment.
Yeah, to be able to identify quickly I did this, but I can change them.
| }} | ||
| elems={{ strong: <strong /> }} | ||
| > | ||
| <> |
There was a problem hiding this comment.
My understanding is that you're using fragments so that <Localized> properly handles the tags inside the message. Can you please add a comment about this, otherwise it's a bit surprising.
There was a problem hiding this comment.
Yes, that's the reason. Added a comment here.
| // This is also the case for drop-function transform. We need to have a | ||
| // generic mechanism for: if the selected call node (after the transformation | ||
| // has been applied to the call path) is not present in the call tree, run | ||
| // some generic code that finds a close-by call node which is present. |
There was a problem hiding this comment.
Can you please file a bug and add the number here?
There was a problem hiding this comment.
Filed it and added it here.
| // Filter string may include "-" characters, so we need to join them back. | ||
| const filterString = filter.join('-'); |
There was a problem hiding this comment.
Now that we use the marker name, what do you think of using the index in the stringTable instead of the fullstring? If we want to change to a string in the future, we can still change the prefix (m -> M) for example. This would make the filter string a lot shorter and also would remove the problem of the dash character.
There was a problem hiding this comment.
Yes, that makes sense! Change it to use string table index.
|
Thanks for the review! It should be ready for another review now. |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #4610 +/- ##
==========================================
- Coverage 88.63% 88.53% -0.10%
==========================================
Files 293 294 +1
Lines 25990 26159 +169
Branches 6998 7051 +53
==========================================
+ Hits 23035 23159 +124
- Misses 2749 2791 +42
- Partials 206 209 +3
☔ View full report in Codecov by Sentry. |
|
I'm removing my r request because this feature will need to be changed according to our last week discussion. |
|
Thanks for all the feedback, I'm closing this in favor of #4631. I changed the behavior quite a bit, that's why I wanted to start from scratch. |
Fixes #4590.
This PR is ready for feedback and review
Deploy preview
This PR adds a marker context menu item called
Filter samples by “<marker name>” markers.It also changes the per-thread selectors creation pipeline so we can have derived marker selectors for the transform computation. Previously, we created the thread selectors, and then the marker selectors .It made it impossible to get the derived markers for transform applied thread computation. Now we do the thread selectors in 2 steps. We create basic thread selectors first, then we craate the marker selectors, and then we create the more advanced thread selectors that require markers to be computed.
Things I would like to get feedback on:
nameand use it if it has. Otherwise I get the marker name. This is how it's donemarker.data && marker.data.name ? marker.data.name : marker.name. We can possible use marker schema for this, but not sure what to pick there as we have multiple labels.It could be better to look at the commits one by one.
Here's a screenshot of the new context menu item:

Here's a screenshot of the transform navigator:
