-
-
Notifications
You must be signed in to change notification settings - Fork 158
Added xhgui service. #128
base: master
Are you sure you want to change the base?
Added xhgui service. #128
Conversation
I think this is a great addition for ddev-contrib. I followed the recipe and it works! For core ddev I think we need something more streamlined (e.g. no mongo and no other deps), but this certainly is nicely usable. |
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.
Ready to be merged - RTBC / RTBM :) 👍
After ddev/ddev#2983 goes in (preferably after it's in a release) we can revisit this since there's a lot added there now. |
What do you think about this now @penyaskito ? |
Thanks for all the effort. For anyone who wants to use this with xhprof of ddev v1.17.7.
comment out these lines
and save. Otherwise the shutdown function Commenting out the above lines will disable the logging for mysite.ddev.site/xhprof. And the change will be flushed after restarting ddev (there is probably a more consistent solution, but I'm not so used to ddev yet). |
In current prereleases of v1.18, the xhprof_prepend.php is actually in .ddev/xhprof/xhprof_prepend.php, so you can remove the #ddev-generated from that file and change it to your heart's delight. It will be there even after a restart. Anyway, I would love it if you'd try out latest release which is a bit different from what you've been experimenting with. |
Thank your @rfay. I've installed v1.18 and it works great. I followed this guide (without the need of adding Than I adjusted the
And adjusted the logic, provided by this guide, to run xhgui from require_once __DIR__ . '/php-profiler-0.18.0/autoload.php';
require_once __DIR__ . '/xhgui.collector.php'; to function xhgui_log() {
if ( extension_loaded('xhprof') ) {
require_once __DIR__ . '/php-profiler-0.18.0/autoload.php';
require_once __DIR__ . '/xhgui.collector.php';
}
}
// DECIDE BETWEEN ("ddev xhprof on" is required for both, otherwise nothing happens.)
// xhprof_log(); // https://my.ddev.site/xhprof/
xhgui_log(); // http://my.ddev.site:8282/ in wp-config-ddev.php (using Wordpress). That allows me to switch between both ways quickly and I can keep There's probably a nicer solution by adding some custom command |
Sorry I didn't get to this yet @rfay. I'll look at this ASAP and will take @glingener suggestions into account. Ideally we should be able to read the already generated reports with xhprof from xhgui, so no changes should be necessary. Modern xhgui only supports mongo as data storage, so might need another container for importing the files there via crontab or something like that. |
@glingener you won't want to be altering wp-config-ddev.php I don't think - I imagine you'll want to find a place to make changes before or after that, as that file is #ddev-generated, right? Congrats on getting what you like running. It's possible to add more into the default xhprof_prepend.php as well - as you see there's already an example there to add a link to the bottom of page. Probably works in WP. |
It's #ddev-generated, but so far I saw no reason not removing that for the But I like your approach better and moved all the files for xhgui (incl. the profiler) to the |
I'm fine with going forward with this if anybody has the energy to maintain it, but I think the existing |
I think it might be time to resurrect this. |
I noticed this has been coming up alot recently. |
The New Solution/Problem/Issue/Bug:
xhprof+XHGui is useful for profiling applications.
How this PR Solves The Problem:
With the code provided + following the instructions, it's easy to include xhprof in your application for profiling an application.
It provides the instructions for installing xhprof, provides a container for xhprof app itself and for the required xhprof mongodb application who stores the data.
Provided instructions for Drupal 8+, WordPress, Bedrock and general php apps.
Manual Testing Instructions:
Follow the README.md (https://github.com/penyaskito/ddev-contrib/tree/xhgui-service/docker-compose-services/xhgui) with a new app, e.g. for WordPress:
Related Issue Link(s):
None known.