Support Plan
What we have supported and what will support: support plan
Getting Started
Requirement
Dependency | Version | More |
---|---|---|
PHP | php7+ | |
GO | ||
GCC | GCC4.7+ | C++11 |
cmake | cmake3.2+ | |
*inux | windows is on the way | |
pinpoint | 2.0+ | |
composer | class can be automatic pinpoint-cut | |
collector-agent | installed ? |
Installation
Steps
- git clone https://github.com/pinpoint-apm/pinpoint-c-agent.git
Build pinpoint_php module, goto the root directory of pinpoint-c-agent installation package, and do following steps:
- phpize
- ./configure
- make
- make test TESTS=src/PHP/tests/
ps: We recommend you to test whether the module is RIGHT. For PHP5:
make test TESTS=src/PHP/tests5/
- make install
Activate pinpoint-php-module, please add the following configuration into your
php.ini
php.ini
extension=pinpoint_php.so ; Collector-agent's TCP address, ip,port:Collector-Agent's ip,port, please ensure it consistent with the `PP_ADDRESS` of `Collector-Agent` in step2(Build Collector-Agent). pinpoint_php.CollectorHost=Tcp:ip:port pinpoint_php.SendSpanTimeOutMs=0 # 0 is recommanded ; request should be captured duing 1 second. < 0 means no limited pinpoint_php.TraceLimit=-1 ; DEBUG the agent, PHP's log_error should turn on too. ;pinpoint_php.DebugReport=true ;error_reporting = E_ALL ;log_errors = On ;error_log = /tmp/php_fpm_error.log
Use Pinpoint PHP-Agent in your project, and follow the steps below:
We assume that you have installed composer and known how to use it. How to Use Composer?
Add
pinpoint-apm/pinpoint-php-aop
into composer.json and update."require": { ... "pinpoint-apm/pinpoint-php-aop": "dev-master" }
or
composer require pinpoint-apm/pinpoint-php-aop
Add the following constants in the index file of your project:
################################################# define('APPLICATION_NAME','APP-2'); define('APPLICATION_ID','app-2'); define('AOP_CACHE_DIR',__DIR__.'./Cache/'); define('PLUGINS_DIR',__DIR__.'./Plugins/'); define('PINPOINT_USE_CACHE','YES'); require_once __DIR__. path to 'vendor/pinpoint-apm/pinpoint-php-aop/auto_pinpointed.php'; #################################################
APPLICATION_NAME
: Application name.APPLICATION_ID
: Agent ID.AOP_CACHE_DIR
: Where to generateCache
.PLUGINS_DIR
: Path toPlugins
.PINPOINT_USE_CACHE
: 'YES' will not updateCache
when request coming; 'No' will updateCache
when every request coming.(You can also updateCache
by just deleting it.) Considering the performance, we recommend 'YES'. Further more, if you modify the plugins, you should update theCache
to take effect.require_once __DIR__. path to 'vendor/pinpoint-apm/pinpoint-php-aop/auto_pinpointed.php';
: Require pinpoint'sauto_pinpointed.php
.Please add afterrequire_once __DIR__."/../vendor/autoload.php";
, this is very important!
Choose you framework and copy the directory as
Plugins
to the root of your application, autoloadPlugins
incomposer.json
.
Details for frameworks:
We have prepared some examples for you, please goto testapps.
Changes
- Fully support ZTS
- More stability
- Higher performance
- Easily use and maintain
- Support GRPC
F & Q
1. How to regenerate all AOP files?
Delete __class_index_table in Cache/
2. Why not support automatically update AOP files?
We can DO but prefer not to DO! Because we have not yet found an efficient way to implement this and monitoring these files status every time is a bad deal.
3. How much performance does it lose when using?
After full test, the AOP code could spend at least 1ms in our env(E5-2660 v4 @ 2.00GHz). While, the more function/method you monitor, the more you take.
Performance Test Result
3.1 Test Result ☚
3.2 Flarum Test Result ☚
For the developer
Known Issues
1. Exception or error message with a wrong file path.
https://github.com/pinpoint-apm/pinpoint-c-agent/issues/99
2. If I do not use composer/autoloader, can I use this version?
Sorry, pinpoint-php-aop
does not support to wrap the user class (or internal class) without composer/autoloader. By the way, Composer is GOOD. O(∩_∩)O
https://github.com/pinpoint-apm/pinpoint-c-agent/issues/103
3. ~Why not support PHP5.x.~ Already done!
https://www.php.net/supported-versions.php
4. ~Generator function is not supported.~ Already done!
https://github.com/pinpoint-apm/pinpoint-c-agent/issues/100