bankiru / yii-pinba
Installs: 13 251
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 11
Forks: 0
Open Issues: 0
Requires
- php: ^5.4 | ^7.0
- yiisoft/yii: ~1.1.17
Suggests
- ext-pinba: You should install pinba extension for php
This package is not auto-updated.
Last update: 2022-11-07 16:46:18 UTC
README
Simple Yii extension that incapsulates Pinba configuration and methods.
Installing
You should install php pinba extension manually. See documentation.
Composer
"require": {
"bankiru/yii-pinba": "~0.1"
}
Github
Releases of Pinba extension for Yii framework are available on Github.
Documentation
To enable this extension you need add Pinba to component list in config.php and do some simple configurations
'pinba' => array(
'class' => 'Bankiru\\Yii\\Profiling\\Pinba\\Pinba',
'fixScriptName' => true, // changes script_name in pinba to controller/action or to command args in cli mode. Default true
'scriptName' => null, // default null (if null pinba would use autodetect)
'hostName' => null, // default null (if null pinba would use autodetect)
'serverName' => null, // default null (if null pinba would use autodetect)
'schema' => null, // default null (if null pinba would use autodetect)
'profileEvents' => [], // default empty array
)
In addition you need to add pinba extension to preload
section.
Available 2 methods to profile.
- through direct call Timer class
- using yii events
Timers class
Timer class has static methods:
- start
- stop
- add
- delete
- tagsMerge
- tagsReplace
- dataMerge
- dataReplace
- getInfo
- getAll
- stopAll
which wraps pinba_* functions.
Yii events
Extension always tracks CApplication request (onBeginRequest, onEndRequest).
Custom profilings can be added through config. For example:
'pinba' => array(
'class' => 'Bankiru\\Yii\\Profiling\\Pinba\\Pinba',
'profileEvents' => [
['my-component-name', 'profiling_action_name', 'onBeginActionEventName', 'onEndActionEventName'],
],
)