我们已经支持以及将要支持的计划详情: 支持计划
依赖 | 版本 | 附加 |
---|---|---|
PHP | php 7+ |
|
GO | ||
GCC | GCC 4.7+ |
C++11 |
cmake | cmake 3.2+ |
|
*inux | windows is on the way |
|
pinpoint | 2.0+ |
|
composer | class can be automatic pinpoint-cut | |
collector-agent | installed ? |
-
执行命令:git clone https://github.com/pinpoint-apm/pinpoint-c-agent.git
-
安装 pinpoint-php-module, 在pinpoint-c-agent安装包的根目录下,执行以下命令:
-
phpize
-
./configure
-
make
-
make test TESTS=src/PHP/tests/ (我们建议您执行此命令,测试该模块是否正确。PHP5请执行
make test TESTS=src/PHP/tests5/
) -
make install
-
激活 pinpoint module,请将以下内容添加到你的
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
-
-
在您的项目中使用Pinpoint PHP-Agent,请执行以下步骤:
我们假设您已经安装composer,并了解怎么使用composer如何使用 Composer?
-
安装
pinpoint-apm/pinpoint-php-aop
, 在composer.josn
的require
中添加"pinpoint-apm/pinpoint-php-aop": "v2.0.1"
:"require": { ... "pinpoint-apm/pinpoint-php-aop": "v2.0.1" }
-
在项目的入口文件中添加下面的常量:
################################################# 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'); define('PP_REQ_PLUGINS', '\Plugins\PerRequestPlugins'); #define('USER_DEFINED_CLASS_MAP_IMPLEMENT',"\Plugins\Framework\app\ClassMapInFile"); require_once __DIR__. path to 'vendor/pinpoint-apm/pinpoint-php-aop/auto_pinpointed.php'; #################################################
APPLICATION_NAME
: 应用名称.APPLICATION_ID
: Agent ID.AOP_CACHE_DIR
: 保存Cache
文件夹的位置.PLUGINS_DIR
:Plugins
文件夹的路径.PINPOINT_USE_CACHE
: 'YES'-有请求时不会自动更新Cache
; 'No'-有请求时将会自动更新Cache
(您也可以手动更新Cache
,直接删除Cache
就可以)。考虑到性能,建议设置为'YES'.如果您修改了Plugins,需要更新Cache
后才能生效。PP_REQ_PLUGINS
:PerRequestPlugins
的路径(PerRequestPlugins
是基本的请求拦截器, 不同的PHP框架的拦截器不同,我们已经为您准备了一些框架的PerRequestPlugins
,请到这里获取,(例如:swoole's PerRequestPlugins)。欢迎PR其他框架哟~require_once __DIR__. path to 'vendor/pinpoint-apm/pinpoint-php-aop/auto_pinpointed.php';
: 导入pinpoint的auto_pinpointed.php。请在require_once __DIR__."/../vendor/autoload.php";
之后添加,这很重要
-
拷贝Plugins到您的项目根路径下,并在
composer.josn
中自动加载Plugins
. Frameworks: ThinkPHP5 Yii2 laravel另外,我们还准备了一些例子以供参考:testapps。
-
- 完全支持 ZTS
- 更加稳定
- 性能更高
- 易于使用和维护
- 支持 GRPC
在Cache/中删除 __class_index_table
我们可以支持但不建议这样做!因为我们还没有找到一种有效的方法来实现这一点,每次监测这些文件的状态结果都很糟糕。
在完全测试之后,AOP代码可以在我们的环境(E5-2660 v4 @ 2.00GHz)中至少消耗1ms。但监测的功能/方法越多,损耗的性能也就越多。
3.1 测试结果 ☚
3.2 Flarum的测试结果 ☚
抱歉,pinpoint-php-aop
不支持打包没有composer/autoloader的用户类(或内部类)。顺便说一下,composer挺不错的O(∩_∩)O