Closed Bug 1870801 Opened 2 years ago Closed 2 years ago

Allow limiting depth and top level frames being logged when tracing javascript

Categories

(DevTools :: Debugger, enhancement)

enhancement

Tracking

(firefox123 fixed)

RESOLVED FIXED
123 Branch
Tracking Status
firefox123 --- fixed

People

(Reporter: ochameau, Assigned: ochameau)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Thanks to bug 1870710, it will be easier to start the tracer when we reproduce a bug, but then it may log too many frames.
We could introduce two settings to limit the depth and limit the number of top level frames being logged.
The second setting would automatically stop the tracer, while the first would only reduce the depth of all stack being logged.

The JavaScript Tracer may be initiated by the debugger, or stoped by itself when reaching some limit.
In these cases, the start and stop messages wouldn't have been logged in the console.

Assignee: nobody → poirot.alex
Status: NEW → ASSIGNED

These two settings are only available via the web console commands as they expect number as arguments
which is hard to implement via the context menu on the debugger button.

Move stdout logging to a dedicated method as onEnterFrame reached eslint complexity limit.

Alex, did you got request for that feature from users? I don't see how this could be helpful, as when you're looking for something, you probably want everything ?

Flags: needinfo?(poirot.alex)

(In reply to Nicolas Chevobbe [:nchevobbe] from comment #3)

Alex, did you got request for that feature from users? I don't see how this could be helpful, as when you're looking for something, you probably want everything ?

No. But actually, in the currrent bucket of work around tracing, I only got the explicit request for the logging of DOM Events.
Even the native method tracking was a personal suggestion, as well as argument logging.

But let me explain the reasoning behind this feature:
When we are testing this in reviews, we aren't testing in real world web compat scenarios involving things like Google Tag Manager and heavy loaded pages.
In the wild, the main challenge of the tracer is the overload of data!
While the key shortcut, start on next mousedown/mouseup, start on next page load all help reduce tracer output by delaying the record as much as possible, there should also be features to eagerly stop the record.

Depth and records may feel arbitrar cuts, but I'm convinced it can be useful for thoughtful engineer:

  • Depth set to 1 could be useful to only see the dom events and first function being called. You can then set a breakpoint in one of these functions and investigate down the call stack by setting in. Or ideally later have tracer breakpoint to focus on just this method.
  • Record set to 1 may help see only the mousedown event listener and nothing asynchronous being running after that, or any other DOM event.
    On real (messy) web pages, these limits help when you are reaching the web console size limit. When you are tracing a page load, you quickly hit it.

Also, I wanted to keep the JS Tracer behind a preference to ease working on many features like these.
Similarly to the Profiler, if we want to later expose that to general audience, we may expose simple versus expert settings.
We may keep the advanced features for the console commands, while keeping the UI button simplier.

Flags: needinfo?(poirot.alex)

alright, I understand. I feel like those could be addressed by more capable UI features, but I agree that it's cheaper to have those as command argument for now so we can prototype and experiment

Pushed by apoirot@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/885f112d1076 [devtools] Log JS tracer start/stop, even when not initiated from console command. r=devtools-reviewers,nchevobbe https://hg.mozilla.org/integration/autoland/rev/c0f126c79de5 [devtools] Allow limiting depth and max top level frames when tracing javascript. r=devtools-reviewers,nchevobbe,fluent-reviewers,flod

I think I forgot to push latest revision to phabricator before landing.
Try was and is still green on my local, rebased version:
https://treeherder.mozilla.org/jobs?repo=try&revision=f5762db0ae3d38a83db74c66937af4f7377ed0ff
I'll try to land again while having rebased the patch on phab.

Flags: needinfo?(poirot.alex)
Pushed by apoirot@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/0759aca1b4fc [devtools] Log JS tracer start/stop, even when not initiated from console command. r=devtools-reviewers,nchevobbe https://hg.mozilla.org/integration/autoland/rev/8ba077ee1c37 [devtools] Allow limiting depth and max top level frames when tracing javascript. r=devtools-reviewers,nchevobbe,fluent-reviewers,flod
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 123 Branch

== Change summary for alert #40937 (as of Wed, 10 Jan 2024 06:24:27 GMT) ==

Regressions:

Ratio Test Platform Options Absolute values (old vs new)
2% browser-console:parent-process objects-with-stacks linux1804-64-qr 16,434.00 -> 16,765.00

For up to date results, see: https://treeherder.mozilla.org/perfherder/alerts?id=40937


could also be caused by Bug 1873007 , but it sounded less plausible

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: