xk6-browser icon indicating copy to clipboard operation
xk6-browser copied to clipboard

Research: support verbose tracing

Open ka3de opened this issue 1 year ago • 1 comments

Research the possibilities of using the tracing implementation done in #1100, which was mainly targeted towards providing a representation of browser actions to end users, as a means to also provide insights for the lower level browser implementation that can be used for internal debugging purposes. Ideally the tracing functionality will be configurable to address the differences between these two scenarios.

As a minimum we should answer the following questions:

  • How should the tracing detail be configured? Accept a single flag? Accept different possible levels?
  • Which methods should be traced? With which attributes?
  • Do some of these methods require particular implementation due to its async nature?

ka3de avatar Dec 05 '23 09:12 ka3de

@ka3de

For a start, it would be great to see when each instance is deadlocking. At which stage while running a script (i.e. fillform).

For the next step, it would be great to see the associated CDP messages to help with debugging. For instance:

Iter X start (even if it's not a browser iter)
  Connect / Launch
    NewConnection
      EventTargetAttachedToTarget
        NewSession
          CDP messages
        CloseSession
    NewBrowserContext (with ID)
      GrantPermissions
      AddInitScript...
    initEvents
      CDP Events
    end initEvents
  NewPage
    NewFrameManager
      ..
    NewFrameSession
      ..
    initEvents
      ..
    AutoAttach
    AddBinding
Iter End

I've added the most critical ones that can be super helpful when debugging. But it's basically tracking what happens when the fill form example runs. This is not an exhaustive list. Still, I believe coming up with a simpler prototype can help us see what we can improve later.

inancgumus avatar Dec 05 '23 12:12 inancgumus