User tests: Successful: Unsuccessful:
This is a redo of #15472
The goal of this PR is to refactor the debug plugin (currently more than 2.000 lines of code) into smaller pieces.
An external library is used to display a floating debug bar. See a demo
Run
composer install
npm i
Turn on debug and/or language debug and play with the various options in plugin configuration.
Alot
While working on a Symfony project, I was amazed by the debug bar they offer and I thought about the old Joomla! plugin...
Integrating the Symfony bar would require a lot of dependencies from Symfony, probably including the Symfony Application class. While this would be amazing, I suspect that this is not gonna happen any time soon...
So I started playing with maximebf/debugbar which claims to be inspired by the Symfony debug bar, but for "non Symfony" projects ;)
This resulted in some DataCollector
classes which, apart from collecting data, are responsible for bringing the collected data to something "serializable".
This data is then serialized and written to disk for later analysis. (Not implemented yet)
After a thousand words, here are some screens:
Note: Since the "old" code is still in place, you will see the "old" output as well as the "new " output in the screenshots.
The database query tab features including
* Highlighted queries
* Timings and memory reports
* A (clickable) call stack with indication of the "caller" (somewhat experimental)
* Duplicated query check
* Duplicated queries can be filtered Note the filter buttons are at the lower right corner
* A button to "copy" the query to the clipboard
Should look as before, just more readable and compact.
Tested on a 5'' screen with fat fingers and it worked pretty well.
Happy debugging =;)
@todo
Things that should be added (later)@all
Status | New | ⇒ | Pending |
Category | ⇒ | Administration Language & Strings External Library Composer Change Libraries |
Labels |
Added:
?
?
?
|
Category | Administration Language & Strings External Library Composer Change Libraries | ⇒ | Repository Administration Language & Strings External Library Composer Change Libraries |
Yes it can highlight duplicate queries. I don't remember off hand if the debug bar natively supports collecting stack traces, but the Laravel package that extends this does have them so even if it's not a native capability it can be added in.
Actually, we couldn't use the existing database integrations in the main debug bar package anyway. That one only supports PDO, we have non-PDO drivers in our database API (MySQLi and SQL Server).
Does the query tab has duplicate query detection and can show the stack trace? That's two very useful features of the current debug plugin.
Currently only the executed queries are displayed in a custom tab. For the reasons Michael stated we can not use the provided db tab so... - no stack trace, timings, memory etc.
I'd like to propose adding a component that displays additional information like this - in the next PR
YES
hi, will this PR have solution for issue:
e.g. will it speed up stuff?
At the current stage: no - because the "old" code processing db info is still in place - for reference.
My proposal would be to display only the executed queries in the debug bar and move the "extended information" (what we have currently) to a proper page that is displayed by a component - along with all the other information that we store about a request.
On the other hand - do we really need all the information or should we better rely on external tools for database profiling?
Yes things should definitely become faster.
I have not performed any testing on sites with "lots of" queries but I guess that you should note a difference.
can you fix the conflicts here?
Will do..
@elkuku Thank you for your work on this, it is looking very promising.
Here are my initial findings:
I cannot find where I should install this component as Discover doesn't see it.
You can click on a position to jump to the query. This is something we should keep.
The link here goes to phpstorm://open?file=/usr/local/var/www/rsform/plugins/system/pwtseo/language/en-GB/en-GB.plg_system_pwtseo.ini&line=
In your screenshot you have a Deprecated tab, I don't see that. What is needed to trigger that?
Keep up the good work :)
Category | Administration Language & Strings External Library Composer Change Libraries Repository | ⇒ | Administration Language & Strings External Library Composer Change Libraries |
Category | Administration Language & Strings External Library Composer Change Libraries | ⇒ | Administration Language & Strings External Library Composer Change JavaScript Front End Plugins |
I do not know if this is by design but the bars run through the text
Yes, that's the design. I use this same debug bar on the Joomla Framework website for local dev, see https://user-images.githubusercontent.com/368545/36637903-b2229e60-19ab-11e8-9b64-227b812f37f1.png for an example from there. Basically, the time it starts measuring timings for the timeline is the left edge of the window and the time it stops is the right edge, so the bar positioning is somewhat relative to when in the request the timing was captured (and as you can see in that screenshot the timings aren't restricted to a single path, you can start and stop timing measurements a bit more granularly and catch different steps in a "higher" level topic such as the sub-tasks performed by a controller).
Category | Administration Language & Strings External Library Composer Change JavaScript Front End Plugins | ⇒ | Administration Language & Strings JavaScript Repository External Library Composer Change Front End Plugins |
Hello and sorry for the late reply. I had a little accident on my motor bike, broke my finger so I'm typing a little slow - please be patient
Let me respond @roland-d :
This is not implemented yet (code exists only local). The idea is to display all the request informations with all the bells and whistles that we have on a dedicated page (a component output would be the Joonla! way I guess..).
What Michael said..
Yeah because I'm just dumping the array here - Will be pretified in 1.
See 1.
Where's 5.?
See 1.
I was looking into making those clickable, but I think we should leave this also for 1. - please
That looks really bad you're right. On the other hand: If you look closely where the link points to you'll not want click on it...
AHA excellent question *BigGrin*
- There is a "hidden feature" called deprecation logging, I believe most devs are not aware of this...
Please find the plugin setting and.. See my screenshot ;)
I'll do my best - Thanks!
On the other hand I removed all the vendor code, so code reviews may be possible now..
I've also modified the build.js
file to copy the assets from the PHP package. This would obviously mean that you have to run composer install
before npm install
but I guess, since the projects "main" language is PHP, that should be the case anyway... may I ping @dgrammatiko @mbabker @wilsonge or any other dev for some suggestions here?
Category | Administration Language & Strings External Library Composer Change JavaScript Front End Plugins Repository | ⇒ | Administration Language & Strings JavaScript Repository Front End com_content External Library Composer Change Plugins |
Going to test this now, but I first glanced over the code of the PR and I was wondering why there is a debug model in com_content?
After merging this branch into my smart search changes: I really like this! The display of session data is great and the whole display of the debug data is
Category | Administration Language & Strings External Library Composer Change JavaScript Front End Plugins Repository com_content | ⇒ | Administration Language & Strings JavaScript Repository External Library Composer Change Front End Plugins |
Hi @Hackwar alles klar?
Now - the debug model you discovered in com_content
is part of a proposal that I currently can not find an appropriate place for, so I hacked it in com_content
. I feel that introducing a new component like com_debug
or something would be something that need more "fighting with the gate keepers".... So here is the deal:
com_content
in a separate branch here: https://github.com/elkuku/joomla-cms/tree/com_debug as a proposal and for testing.Happy testing
System test failures don't seem related to the code changed here...
Do we need the composer.lock in this commit
You mean here in this PR? I'd say yes, otherwise composer install
won't work as expected?
Ok, I will test it in another way.
Ok, I will test it in another way.
If you get conflicts with the composer.lock
file, accept "mine"
Meanwhile here are some notable changes:
The database query tab has now some new features provided by the 3pd package - I just had to figure out how to use it properly..
The loaded language files are now clickable @roland-d
@elkuku Thank you for the update. The clickable languages is not working for me. Here is what I see:
Seems like a parsing error or something?
As for the DB queries, looking nice especially that you can click the query to get it copied. I just wonder if we can be notified without a JS alert.
Another question is, can we filter so we can see which duplicate queries exist?
The clickable languages is not working for me
This happens if an "old" version of the js file is in use. Please make sure to run npm i
and clear all your browser caches
looking nice especially that you can click the query to get it copied. I just wonder if we can be notified without a JS alert.
Unfortunately we can not modify (or even remove) this functionality without "forking" the source code - which I am very attempted to, just to implement the stack trace display...
can we filter so we can see which duplicate queries exist?
Same as above - you would have to group them first, display only one of the dupes etc.. Maybe you could add something to maximebf/php-debugbar#382
@elkuku I cleaned things up and it is looking much better now.
Unfortunately we can not modify (or even remove) this functionality without "forking" the source code - which I am very attempted to, just to implement the stack trace display...
I was playing around with the Nette framework and they have Tracy the debug bar. https://github.com/nette/tracy for more info. This is also very neat.
Maybe you could add something to maximebf/php-debugbar#382
I will have a look at it.
The following issue I still observe
That should be fixed by the other PR right?
Where in Joomla can you get those Deprecated notices to show up?
Another weekend, another round of features
First of all, I "forked" the sqlqueries widget to our code base to perform some hacking.
Currently added fatures:
NOTE for Re-testers please execute npm run update
or npm i
I was playing around with the Nette framework and they have Tracy the debug bar.
I had a look at tracy before starting here but decided to use phpdebugbar for architectural reasons
The following issue I still observe
Yes the correct functionality depends on the other PR being merged - thanks for testing btw
Where in Joomla can you get those Deprecated notices to show up?
They are all over the place, especially the "core" deprecation, that's why I decided to "filter them... Do you mean you don't get any of them??
Note the filter buttons are at the lower right corner
Awesome. I see for example Duplicate 1, let's say I have 30 duplicate queries. Do I get 30 buttons in that case? (assuming these are 30 unique duplicate queries).
They are all over the place, especially the "core" deprecation, that's why I decided to "filter them... Do you mean you don't get any of them??
Correct I don't get any of them.
Can we make those links clickable too?Correct I don't get any of them.
Do you at least see the "Deprecated" Tab in the debug bar?
Are you sure you enabled Log Deprecated API
in the plugin parameters as in my screenshot in #20380 (comment) ?
Do I get 30 buttons in that case? (assuming these are 30 unique duplicate queries).
How can a duplicated query be unique?
The duplicated queries are "grouped" so you will get a button for every "group"
E.g. for the screenshot you posted earlier #20380 (comment) at point 6. you would get three buttons.
BTW could you do a test with this example? That'd be cool
Can we make those links clickable too?
For now I guess that you should open the call stack and make sure that the "caller" is correct, not sure that this works 100% reliable.. - but nice idea, I'll have a look at this.
Are you sure you enabled Log Deprecated API in the plugin parameters as in my screenshot in #20380 (comment) ?
It was not enabled. I did look for it before but couldn't find it. The tabs are hard to see in J4. Now I see them all.
Log Executed Queries
This option was not set but I can see the queries. So I guess that was confusing as well.
BTW could you do a test with this example?
I will test this and update with the results
I set up 3 duplicate queries and here are the results of showing all duplicates
Duplicates 1 turned off
Duplicates 2 turned off
The current buttons feel a bit awkward as in I need to click so much. Something like a toggle all on/off would be nice. I could just toggle all off and then the ones I would like to see. What do you think of that?
The tabs are hard to see in J4
Fully agree
This option was not set but I can see the queries. So I guess that was confusing as well.
This one actually logs the queries to a file (I believe this has been disabled so the option is useless anyway - will check)
The current buttons feel a bit awkward as in I need to click so much
Yes, well, I believe if you have that much duplicated queries you should better check your code
Actually this is the standard behaviour which is also used to filter log messages.
Meanwhile I made the caller text clickable. Can you confirm those are correct? According to your screenshots you are performing db queries in a template file
@elkuku I tested the caller text clickable for queries and they work but there is a weird side-effect. Every time I click on the link it opens in PhpStorm as expected but it also opens a blank tab. This only happens with the links in the queries.
Actually this is the standard behaviour which is also used to filter log messages.
So we can't have a button to toggle them all on/off?
it also opens a blank tab
I think this should be fixed now - please test.
May I ask how you have set up those clickable links? What's your OS and browser?
I have to confess that this never worked reliable for me, e.g. currently I am on a linux box using chrome or firefox and the most "easy to setup" option was to define the xdebug link as http://localhost:63342/api/file/%f:%l
which works since phpstorm listens on this port while it runs and you can do a lot of nifty things but - I guess the browser will always try to open a new page/tab :(
So we can't have a button to toggle them all on/off?
I didn't say we can't
It's "our" code so the only thing we need to implement a feature is to find somebody with some time to do it
BTW: You complained about the annoying alert message that appears when copying a query...
The code is now under "our control" can be found here https://github.com/joomla/joomla-cms/pull/20380/files#diff-704b78076b8b57b6b9b63fa76f3fd570R44 open for modification
It's "our" code so the only thing we need to implement a feature is to find somebody with some time to do it
Good to know, I will check when I have some time, the same goes for the alert :)
We have another caller here, can you make that clickable as well? The same goes for the Deprecated tab.
Is it possible to get a caller here?
An inconsistency I noticed is that I have no entries in the Log and Untranslated tab and no entries in the Errors tab. The log tab is completely empty but the Errors tab says
I think they should just be blank as the Log and Untranslated tab is if there is no issue.
The Info link takes me to http://joomlacms.test/index.php?option=com_content&view=debug&id=X862e7a4b7e8180b879610361840e5995
I am not sure what to expect from this but now it gives me a 404.
We have another caller here, can you make that clickable as well? The same goes for the Deprecated tab.
I am going to look into this but it will require a fair amount of work so I'm not sure if we should do it after (and only if) this gets merged...
is it possible to get a caller here?
No - Those are just "messages" with everything that is deprecated.
but the Errors tab says
Has been fixed - thanks!
The Info link takes me to
This is supposed to lead you to a page with extended information... The code is actually here: https://github.com/elkuku/joomla-cms/tree/com_debug
BTW I opened a PR regarding the language error display - If you have time to test #21840 that'd be cool.
Thanks for all your testing
I noticed now that these lines are ended with an ellipses but there is more than enough space on the line. Can we have the text just run to the end of the line?
Can we have a counter behind the number of loaded language files?
This is supposed to lead you to a page with extended information... The code is actually here:
Let me know when it is ready to test.
Thanks for all your testing
?
Thank you for the coding. I would love to see this go into 4.0. That will be a great help.
I noticed now that these lines are ended with an ellipses but there is more than enough space on the line. Can we have the text just run to the end of the line?
Your output will be different on a smaller screen - I'd leave this for now
Can we have a counter behind the number of loaded language files?
Done
Let me know when it is ready to test.
I think when this got merged I'll get into bringing this to a "testable" state...
we just need to remove the info link because that doesn't do anything.
Right - has been removed.
This should get another round of tests, before setting to RTC.
Thanks for making those changes. I saw the @todo and thats fine for me - don't know about others
I was just testing a duplicate query issue and it looked like this debugger was giving a different number of queries on the control panel page than the current debugger???
change the php logo with administrator/templates/atum/images/logo-blue.svg
So today I learned how to embed an svg in a css file. It wasn't just copy&paste but involved some hacking (e.g. hex color codes are not supported...) but in the end there is a Joomla! logo
add mysql version to the J! Info section
Done, see screenshot above.
I am using the SysInfoModel
from com_admin
here (why is this class still not autoloadable with a dozen autoloaders in place?? backend => sysinfo
have some way of clearly identifying the language related parts - currently its not obvious until you click on them
I looked into adding a tooltip at least but this doesn't seem to be supported. The other option would be to rename the tab title to make it clearer, but I feel that they might become pretty "long". Maybe we should use abbreviations like Lang Loaded
and Lang Errors
? - WDYT
be consistent in the fonts and styling used between tabs.
The Untranslated Language Strings
(Should we really put this string in the title?...) tab will receive its "own tab" (and corresponding styling) after #21457
I was just testing a duplicate query issue and it looked like this debugger was giving a different number of queries on the control panel page than the current debugger???
That shouldn't be possible since it is using the exact same data - thinking - do you mean the number of duplicates or the total number? both should be the same... need more info
I will send more info tomorrow. Not at my pc right now. For the SVG you can add colour to it with css
Clean install of J4 with multilingual sample data and testing administrator/index.php
With debug on it produced
28 Queries Logged 37.78 ms
4 duplicate found!
2 duplicates: #17 #20
2 duplicates: #40 #43
With this new debug on it produced
20 statements were executed, 2 of which were duplicates, 18 unique
Umm the only thing I can think of is that there are additional changes in
the 4.0 branch which are producing different queries.
I'll update the branch and do some testing later.
Brian Teeman notifications@github.com schrieb am Mi., 29. Aug. 2018,
06:30:
Clean install of J4 with multilingual sample data and testing
administrator/index.php
With debug on it produced28 Queries Logged 37.78 ms
4 duplicate found!
2 duplicates: #17 #20
2 duplicates: #40 #43With this new debug on it produced
20 statements were executed, 2 of which were duplicates, 18 unique
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#20380 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AACEukuAjMd7X9AGqjMYZoa3xo1GSzT7ks5uVntagaJpZM4T8kvb
.
Sorry yesterday was to short... I would be in favor not only to abolish this crazy DST thing but also to add some additional hours to every day so we can be more productive...
That said, here are my findings:
I checked out the latest from 4.0, installed the german language pack, installed ML sample data, sailed to admin/index.php and got - nothing
Then I switched to the debug-bar branch and - got some dupes:
Then I merged in the 4.0 branch and - no more dupes...
So I guess I was right with my previous assumption. IIRC there was a PR about duplicated queries merged recently - could you test once more please?
I tested this and this looks very good. I can't speak on the missing queries part, but what I'm missing is the used memory of the different parts in the Profile tab. Can you have a look there?
I also have my issues with the design. I guess it is mostly due to being accustomed to the current style of the debug bar. Right now the texts to me appear pretty much like a wall. Especially the queries are not easy to read for me. Maybe we can color the icons/buttons/action areas of each query in the Joomla colors? And have a stronger seperator between the queries?
Please run composer install and npm install
infograf768 notifications@github.com schrieb am Fr., 31. Aug. 2018, 23:53:
Class 'DebugBar\DebugBar' not found
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#20380 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AACEupIi3dtnAx78Czf24UBi9_mZ2npYks5uWhLNgaJpZM4T8kvb
.
Yeah, I was in the wrong repository.
Had an error though. Had to type y
Updating joomla/test-system dev-4.0-dev (472c69a => 0548840): The package has modified files:
M src/drone-run.sh
Discard changes [y,n,v,d,s,?]? y
Needs some kind work.
UI is very confusing. Things are stuck to one another and hardly readable (font size, line height).
Here color instead of Loaded/Not Loaded (not good for colour blind people). Maybe using both would be better. Alsdo no need imho to repeat the name of the file with these 2 columns.
Here constants are not displayed fully.
NOTE: just found out a change in Loaded/Not Loaded ini files. Must have been for some times as it is the same in 3.8.x
When a language file does not exist in a language, it is rightfully tagged as Not Loaded, but if I remember well, some time ago, it would show nearby the en-GB equivalent file as loaded instead.
Category | Administration Language & Strings External Library Composer Change JavaScript Front End Plugins Repository | ⇒ | Administration Language & Strings JavaScript Repository External Library Composer Change Libraries Front End Plugins |
what I'm missing is the used memory of the different parts in the Profile tab. Can you have a look there?
I think we can at least display the amount (using numbers) would this be helpful?
the queries are not easy to read for me
I've changed the color of the separator line to a beautiful blue and added some padding - what do you think/see?
Maybe we can color the icons/buttons/action areas of each query in the Joomla colors?
That sounds like a nice idea but I'm afraid that if I perform this task it will look horrible - trust me
Here color instead of Loaded/Not Loaded (not good for colour blind people). Maybe using both would be better.
I've added a +
or a -
sign accordingly - WDYT?
Alsdo no need imho to repeat the name of the file with these 2 columns.
The first column is supposed to be the "extension" that is trying to load the language file(s) - Note the first line joomla
is loading the xx-XX.ini
file
if I remember well, some time ago, it would show nearby the en-GB equivalent file as loaded instead.
Actually I noticed the same thing. As you can see in my screenshot this is different in admin and site...
Here constants are not displayed fully.
So instead of waiting for #21457 being merged, I changed (J)Language here in this PR and also added the full stack trace.
I had a look on your pr and some parts are missing according to your description. For example the duplicates query or the call stack of a query.
some parts are missing according to your description. For example the duplicates query or the call stack of a query.
I made the query traces optional to avoid performance problems on "large" sites. so please make sure that you enabled them in plugin options.
Note: The "Query Types" option is currently not functional
As for the duplicated queries, that should work as announced - what output do you get / expect?
Can we get one more test and then I would suggest we merge it and do finalize the other issues in their own pr's.
Status | Pending | ⇒ | Ready to Commit |
Ready to Commit after required one more test.
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-09-10 06:47:15 |
Closed_By | ⇒ | laoneo | |
Labels |
Added:
?
|
Thank you very much for this nice change!
Very happy to see this go in. +1 for progress.
Does the query tab has duplicate query detection and can show the stack trace? That's two very useful features of the current debug plugin.