A Puppet module that installs XHGui, a MongoDB-backed GUI for XHProf.
In your Puppet manifest:
class { 'xhgui': }
You can set the following parameters:
version
: either a tagged version or a commit hash to install; defaults tomaster
sample_size
: see below (defaults to100
)query_trigger
: a URL query string that will enable profiling for the request (disabled by default)dir
: directory where to install XHGui; defaults to/var/www/xhgui/{version}
vhost_name
: used to create an Apache vhost; if you want no vhost, set this toundef
mongo_host
: host your MongoDB server can be reached at; defaults to127.0.0.1:27017
mongo_db
: MongoDB database name; defaults toxhprof
xhprof_package
: custom XHProf package namephp_mongo_package
: custom PHP MongoDB module namewww_user
: custom webserver user
For instance:
class { 'xhgui':
vhost_name => 'stats.my_app.dev',
php_mongo_package => 'php53u-pecl-mongo'
}
In your application's Virtual host configuration (for instance the .htaccess
file):
php_value auto_prepend_file "/var/www/xhgui/external/header-custom.php"
SetEnv XHGUI_SAMPLE_SIZE 100
The XHGUI_SAMPLE_SIZE
environment variable determines how often requests will
be profiled: a sample size of 100 means one in every 100 requests will be
profiled. To profile all requests, set XHGUI_SAMPLE_SIZE
to 1.
By default, you can access XHGui at http://xhgui.domain.extension.
Enable the query string trigger in your Puppet manifest:
class { 'xhgui':
# ...
query_trigger => 'profile'
# ...
}
And then request the URI with your query string, e.g., http://dev.local/some/url?profile.