-
-
Notifications
You must be signed in to change notification settings - Fork 579
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
feat: Add toggle option for xhprof command, rework xdebug, fixes #5782 #6082
feat: Add toggle option for xhprof command, rework xdebug, fixes #5782 #6082
Conversation
Download the artifacts for this pull request:
See Testing a PR. |
See ddev/pkg/ddevapp/ddevapp_test.go Lines 1097 to 1209 in b0fb8ce
Your IDE should have been able to find this! :) |
Does this mean that you often use xhprof? |
I almost never use it, but if there's anyone using DDEV who does a lot of profiling, I could see this being helpful - while at the same time it adds next to no additional maintenance. |
If I had done a blanket search for Looking at that test, it's testing the underlying |
The xhprof command just runs enable_xhprof, etc. I found the test by using symbol search and typing TestXhprof and it brought it right up (Goland) |
By that argument there's no need for me to update any tests, because that's still what it's doing. That doesn't test whether the existing |
I'm happy to add testing coverage for the actual |
It's all good, no need to go further IMO. Maybe when we integrate xhprof more thoroughly later this year with integrating the ddev-xhgui behavior. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested, looks good to me 👍
P.S. Nice refactoring for the xdebug
command, thanks!
In testing this PR I did I was testing on macOS, and where this happened I was on php 8.2
|
Ohhh, interesting. I guess that's 'cause in order to get the xdebug status, we're executing php code while xdebug is enabled - and xdebug is trying to connect to an IDE or anything that'll listen, and not finding anything to connect to? Probably we should use |
|
You're right, congratulations! This doesn't happen if PhpStorm IDE isn't listening! |
I think that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine, thanks so much, and sorry for the long wait.
I've asked our local xhprof expert, @tyler36, to take a quick look, but this can be pulled in the morning if he either has no objections or can't get to it.
else | ||
enable_xdebug | ||
echo "0" | ||
fi | ||
;; | ||
v2*) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, I forgot all about Xdebug v2. But I guess we still support several PHP versions that can only have that.
status=$(php -m | grep 'xhprof') | ||
if [ "${status}" = "xhprof" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be simpler with
if php -m | grep xhprof >/dev/null; then
but it's fine the way it is.
Seems good to me. Test
$ ddev -v
ddev version v1.23.0-beta1-23-gbb51e6fc8
$ ddev xhprof toggle
Enabled xhprof.
After each web request or CLI process you can see all runs, most recent first, at
https://xhprof-test.ddev.site/xhprof
Test with tyler36/ddev-xhgui
ddev get tyler36/ddev-xhgui
ddev restart
ddev composer require perftools/php-profiler --dev
if (file_exists("/mnt/ddev_config/xhgui/collector/xhgui.collector.php")) {
require_once "/mnt/ddev_config/xhgui/collector/xhgui.collector.php";
}
ddev xhprof toggle
ddev xhgui
Test Xdebug still functions
ddev xdebug on
|
The Issue
The
xdebug
command has a toggle option, butxhprof
doesn't. They're both really similar in their operation so it makes sense to add addev xhprof toggle
option.How This PR Solves The Issue
Adds the option.
Also some unrelated-but-adjacent refactoring of xdebug, which was pretty convoluted.
Manual Testing Instructions
ddev xhprof toggle
and validate the status withddev xhprof status
tab
after typingddev xhprof
gives youtoggle
amongst the other options.ddev xdebug toggle
andddev xdebug status
as a sanity check for the refactorAutomated Testing Overview
Existing tests should cover the xdebug refactoring.
There's no tests at all for xhprof that I could find, so adding them seems out of scope. Happy to add if maintainers disagree with that assessment though.
Related Issue Link(s)
toggle
argument #5782Release/Deployment Notes
N/A