Skip to content

Commit 1d9998b

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 1d9998b

2 files changed

Lines changed: 24 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: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import {
1616
type CliTestContext,
1717
} from './utils';
1818

19+
import type { FilterStackResult } from '../../protocol';
20+
1921
describe('profiler-cli basic functionality', () => {
2022
let ctx: CliTestContext;
2123

@@ -256,6 +258,24 @@ describe('profiler-cli basic functionality', () => {
256258
expect(afterPop.filters).toHaveLength(0);
257259
});
258260

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

0 commit comments

Comments
 (0)