Skip to content

profiler-cli: include per-marker fields and data in --list --json - #6275

Merged
fqueze merged 1 commit into
firefox-devtools:mainfrom
fqueze:profiler-cli-list-json-fields-pr
Sep 22, 2026
Merged

fqueze merged 1 commit into
firefox-devtools:mainfrom
fqueze:profiler-cli-list-json-fields-pr

Conversation

@fqueze

@fqueze fqueze commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Main | Deploy preview

thread markers --list --json could filter on a payload field (--search eventType:keydown) without returning it, so reading the values back meant one marker info call per marker. Rows now carry markerType, fields, data and innerWindowID; no existing key changes value.

data elides a CompositorScreenshot's base64 JPEG to { elided: true, length, preview }, which keeps a 100-row response at 27KB instead of 940KB. Elision is keyed by field identity rather than size: a screenshot URL and a real Preference Read.prefValue measured 2855 and 2939 chars, so no byte cap separates them.

@fqueze
fqueze requested a review from canova August 20, 2026 16:58
@codecov

codecov Bot commented Aug 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.65217% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.08%. Comparing base (a8970fd) to head (7956aa5).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/profile-query/formatters/marker-info.ts 95.65% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6275      +/-   ##
==========================================
+ Coverage   84.03%   84.08%   +0.04%     
==========================================
  Files         354      354              
  Lines       38100    38287     +187     
  Branches    10662    10744      +82     
==========================================
+ Hits        32018    32194     +176     
- Misses       5654     5665      +11     
  Partials      428      428              

☔ View full report in Codecov by Harness.
📢 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.

@canova
canova requested review from fatadel and removed request for canova September 4, 2026 15:02
Comment thread src/profile-query/types.ts Outdated
export type MarkerFieldValue = {
key: string;
label: string;
value: any; // Raw, with string-table indexes already resolved

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 is a slightly incorrect claim because collectMarkerFields pushes the unresolved payload value, so on the same --list row fields[].value is a numeric index while data[key] is the resolved string for unique-string/flow-id/terminating-flow-id fields.
We either need to resolve once (via isStringIndexMarkerField) and derive both fields and data from that, or change the comment.

Comment thread profiler-cli/schemas.txt Outdated
FlatMarkerItem:
{
handle, name, label, duration?, hasStack, category,
start, // absolute ms ("startTime" in thread-network)

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.

start here is marker.start - zeroAt (profile-relative), and thread network's startTime is the unshifted marker.start.
Better: "ms since profile start"?

markerType: marker.data?.type,
fields: collectMarkerFields(marker, markerSchemaByName, stringTable),
data,
innerWindowID:

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.

Top-level innerWindowID duplicates data.innerWindowID on the same row. Is there a consumer that needs it hoisted? There is also getInnerWindowID(data) helper in page-load.ts.

continue;
}
const resolved =
stringIndexFields?.includes(key) && typeof value === 'number'

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.

Could we reuse isStringIndexMarkerField from marker-schema.ts here? (already imported)

const m = result.flatMarkers![0];
// Guard against the fixture silently storing a string: if `url` were not an
// index, resolution would be a no-op and this test would prove nothing.
expect(typeof urlIdx).toBe('number');

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 can't fail since indexForString always returns a number. Maybe worth correcting the comment too.

* Build a profile with one CompositorScreenshot marker whose `url` is a real
* index into the string table, rather than an already-resolved string.
*
* `getProfileWithMarkers` stores payload values verbatim, so passing a string

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.

The claim isn't accurate - it converts unique-string fields to string indexes for any schema in markerSchemaForTests. The URL survives only because there's no CompositorScreenshot schema in the fixtures. Worth rewording.

@fatadel fatadel 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.

Thanks for the PR, @fqueze! I've left some comments - most of them are not that important but two are worth addressing before we merge, imo (@types.ts:53 and @schemas.txt:191).

@fqueze
fqueze force-pushed the profiler-cli-list-json-fields-pr branch from baa4446 to a063f5e Compare September 14, 2026 18:53
@fqueze
fqueze requested a review from fatadel September 14, 2026 18:53

@fatadel fatadel 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.

Thanks for addressing the issues! Two minor things left:

  1. collectMarkerFields is also used by the existing marker info --json command but we are changing its output here (number becoming string). We should at least document it, if it's intentional.
  2. Stall PR description: it still says rows include top-level innerWindowID, but that field was removed and is now available only under data.

`thread markers --list --json` could filter on a payload field
(`--search eventType:keydown`) without returning it, so reading the values back
meant one `marker info` call per marker. Rows now carry `markerType`, `fields`
and `data`.

`fields[].value` reports unique-string, flow-id and terminating-flow-id fields
as the resolved string rather than the string table index, so it agrees with
`data` for the same key. `collectMarkerFields` is shared, so this changes those
values in `marker info --json` too; schemas.txt documents it.

`data` elides a CompositorScreenshot's base64 JPEG to
`{ elided: true, length, preview }`, which keeps a 100-row response at 27KB
instead of 940KB. Elision is keyed by field identity rather than size: a
screenshot URL and a real `Preference Read.prefValue` measured 2855 and 2939
chars, so no byte cap separates them.

`profile markers` rows are typed as `FlatMarkerItem` plus thread identity, so
they gain the same three keys.
@fqueze
fqueze force-pushed the profiler-cli-list-json-fields-pr branch from a063f5e to 7956aa5 Compare September 22, 2026 13:55
@fqueze
fqueze enabled auto-merge (squash) September 22, 2026 13:56
@fqueze
fqueze merged commit fcc22b1 into firefox-devtools:main Sep 22, 2026
21 checks passed
canova added a commit that referenced this pull request Sep 22, 2026
Changes:

[fatadel] Show a category breakdown in profiler-cli (#6256)
[fatadel] Show allocation data in the cli (#6246)
[Florian Quèze] profiler-cli: name the process in the thread banner, and
follow the queried thread (#6269)
[fatadel] Drive PII sanitization from marker schemas (#6291)
[fatadel] Move FileIO table labels into marker schemas (#6296)
[Florian Quèze] profiler-cli: add a thread list command (#6273)
[Nazım Can Altınova] Update oxfmt 0.63.0 → 0.68.0 (major) (#6316)
[Markus Stange] Add missing finishRawMarkerTableBuilder. (#6318)
[Markus Stange] Fix the upload error button contrast (#6315)
[Markus Stange] Allow typed arrays in the nativeSymbols table (#6300)
[Markus Stange] Remove brittle test. (#6322)
[Markus Stange] Fix file extension typo. (#6325)
[Nazım Can Altınova] Add a permalink command to profiler-cli for already
published profiles (#6331)
[Markus Stange] Typed arrays + flags for the FuncTable (#6323)
[Florian Quèze] profiler-cli: add profile markers for cross-thread
marker search (#6276)
[fatadel] Convert extension text markers to structured payloads (#6314)
[Florian Quèze] profiler-cli: include per-marker fields and data in
--list --json (#6275)
[Nazım Can Altınova]  Add `--with-samply` to "profiler-cli load" (#6339)
[Markus Stange] Speed up call tree sidebar by sharing work with the
activity graph (#6329)
[Nazım Can Altınova] 🔃 Sync: l10n -> main (Sept 22, 2026) (#6341)
[Nazım Can Altınova] Bump profiler-cli version to 0.10.0 (#6342)

And special thanks to our localizers:

el: Jim Spentzos
ro: robbp
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.

2 participants