Skip to content

Commit 4e54051

Browse files
committed
Include --search option in pq filter push
This fixes commands like: ``` pq filter push --during-marker --search Paint ``` This was already possible to do this with ephemeral filters like ``` pq thread samples --during-marker --search Paint ```
1 parent e775e55 commit 4e54051

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

profiler-cli/src/commands/filter.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ export function registerFilterCommand(
3131
.command('push')
3232
.description('Push a sticky sample filter')
3333
.option('--thread <handle>', 'Thread handle')
34+
.option(
35+
'--search <term>',
36+
'Marker search text (used with --during-marker / --outside-marker)'
37+
)
3438
)
3539
).action(async (opts) => {
3640
const spec = parseFilterSpec({

profiler-cli/src/test/integration/basic.test.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,33 @@ describe('profiler-cli basic functionality', () => {
256256
expect(afterPop.filters).toHaveLength(0);
257257
});
258258

259+
it('filter push supports --during-marker with --search', async () => {
260+
await cli(ctx, ['load', 'src/test/fixtures/upgrades/processed-1.json']);
261+
await cli(ctx, ['thread', 'select', 't-0']);
262+
263+
await cli(ctx, ['filter', 'push', '--during-marker', '--search', 'Reflow']);
264+
265+
const filterListResult = await cli(ctx, ['filter', 'list', '--json']);
266+
const filterList = JSON.parse(filterListResult.stdout) as {
267+
filters: Array<{
268+
transforms: Array<{
269+
type: string;
270+
filterType?: string;
271+
filter?: string;
272+
}>;
273+
description: string;
274+
}>;
275+
};
276+
277+
expect(filterList.filters).toHaveLength(1);
278+
expect(filterList.filters[0].transforms).toEqual([
279+
{ type: 'filter-samples', filterType: 'marker-search', filter: 'Reflow' },
280+
]);
281+
expect(filterList.filters[0].description).toBe(
282+
'during marker matching: "Reflow"'
283+
);
284+
});
285+
259286
it('ephemeral sample filters do not persist into session state', async () => {
260287
await cli(ctx, ['load', 'src/test/fixtures/upgrades/processed-1.json']);
261288

0 commit comments

Comments
 (0)