Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add debugging tools to admin bar #3588

Closed
schlessera opened this issue Oct 22, 2019 · 9 comments
Closed

Add debugging tools to admin bar #3588

schlessera opened this issue Oct 22, 2019 · 9 comments
Labels
Developer Tools Enhancement New feature or improvement of an existing one UX WS:UX Work stream for UX/Front-end

Comments

@schlessera
Copy link
Collaborator

Feature description

As debugging is a big part of working with the AMP plugin, I think we need to ensure we provide as many tools as possible to make this as easy as it can be.

Right now, debugging anything that happens during the shutdown handler can only be properly inspected through XDebug or logging. The most straight-forward way that most developers use to get quick info (dumping) is not accessible at that point.

I'd like to add a debugging toolset to the AMP admin bar integration (maybe hidden behind a AMP_DEBUG switch?) that shows meaningful diagnostic data, and most of all, provides a container to dump data into.

A developer should be able to do something like AMP_Debug::dump( $some_variable ); and it would populate a submenu in the admin bar with entries.

Each dump would show how many times it was triggered, and what the individual values were.

Cheap example menu structure diagram thingy:

AMP (top-level menu entry)
   Re-validate
   View non-AMP version
   ---
   CSS Size
      [...]
   Dumps
      $some-variable [6]
         (bool) true
         (bool) true
         (bool) true
         (bool) true
         (bool) true
         (bool) false

This would come in extremely handy for getting a quick overview of what a certain piece of code does, and could even be used on production sites (😬).


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

Implementation brief

QA testing instructions

Demo

Changelog entry

@schlessera schlessera added Enhancement New feature or improvement of an existing one UX labels Oct 22, 2019
@schlessera
Copy link
Collaborator Author

The idea for this came from the Tracy Debugger, which provides a bdump() for dumping into the debugger bar:
https://tracy.nette.org/en/guide#toc-variable-dumping

@swissspidy
Copy link
Collaborator

I've always been dreaming about a Query Monitor integration... If the solution here is implementation agnostic, that would be huge.

@schlessera
Copy link
Collaborator Author

The main work is collecting the data. Whether you then output it as a list in the admin bar or a list in QM is just a matter of picking the right classes...?

@swissspidy
Copy link
Collaborator

That's what I wanted to hear, thanks :-)

@westonruter
Copy link
Member

westonruter commented Oct 23, 2019

CSS Size

See also #2169 and #1801. It would be cool to show a <meter> element indicating how close the user is to the 75KB limit before going to the Validated URL screen, and (currently) looking at the source code of the page for the CSS manifest HTML comment.

A developer should be able to do something like AMP_Debug::dump( $some_variable ); and it would populate a submenu in the admin bar with entries.

I often dump out variables with this:

error_log( json_encode( $x, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ) );

I then tail the error log. Would this be any different other than avoiding the need to have access to the error log?

@amedina
Copy link
Member

amedina commented Apr 1, 2020

@schlessera Have you continued exploring this?

@kmyram kmyram added the WS:UX Work stream for UX/Front-end label May 15, 2020
@jwold
Copy link
Collaborator

jwold commented Aug 5, 2020

Is there any UX work that I can support on this, or is it already pretty much thought out?

@westonruter
Copy link
Member

I think we need to first nail down what information specifically we want to surface from a technical perspective, and then we can explore UX.

@amedina
Copy link
Member

amedina commented Aug 5, 2020 via email

@westonruter westonruter closed this as not planned Won't fix, can't repro, duplicate, stale Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Developer Tools Enhancement New feature or improvement of an existing one UX WS:UX Work stream for UX/Front-end
Projects
None yet
Development

No branches or pull requests

6 participants