Skip to content

Commit

Permalink
Change manual
Browse files Browse the repository at this point in the history
  • Loading branch information
eeliu committed Apr 29, 2020
1 parent e4e376e commit 6a83460
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 27 deletions.
4 changes: 2 additions & 2 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## v0.2.3

- Support Yii framework classloader
- Add some out-of-box plugins for flraum
- Support Yii framework classloader [(How to use pinpoint-php into Yii?)](PHP/pinpoint_php_example/demo/yii-demo/Readme.md)
- Add some out-of-box plugins for flraum [ (How to use pinpoint-php into Flarum?)](PHP/pinpoint_php_example/demo/Flarum-demo/Reademe.md)
- Fix bug in reference parameters
- Supporting the return type is object
4 changes: 3 additions & 1 deletion DOC/PHP/User Manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,16 @@ Pinpoint php agent employs [php_simple_aop](https://github.com/eeliu/php_simple_
> TPS: Time per request
> TPR: Requests per second
[How to use pinpoint-php into Flarum?](../../PHP/pinpoint_php_example/demo/Flarum-demo/Reademe.md)

> Call Tree
![CallTree](../images/Flarum-callstack.png)

> Summary
* Less than 5% loss, when Flarum add PHP Agent.

If you care about the performance most, you can call pinpoint-php agent module API directly, which is written by C&C++.
If you care about the performance most, you can call pinpoint-php agent module API directly, which is written by C&C++. [(pinpoint-php api)](../../PHP/pinpoint_php_ext/pinpoint_php_api.php)

## 2 How to hook a object ?

Expand Down
16 changes: 11 additions & 5 deletions PHP/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,14 @@ v0.2.x|✘|✘|✔|✔
Framework|v0.1.x|v0.2.x
----|-----|----|
Laravel|✔|✔
ThinkPHP|✔|✔
EasySwoole|✘|✘
ThinkPHP|✔|✘
YII|✔|✔
Workerman|✘|✔
EasySwoole|✘|✔

> Note
1. We are trying to support PHP asynchronous Framework. Such as Workerman and EasySwoole
2. If your php application does not support composer(such as woredpress,phpwind etc), the only choice is v0.1.x.
1. If your php application does not support composer(such as woredpress,phpwind etc), the only choice is v0.1.x.

#### Stability

Expand All @@ -60,7 +61,10 @@ Functional|v0.1.x|v0.2.x



#### Performance Loss Under Stress Test



#### Performance Loss Under Stress Test

> Test Scene
Expand All @@ -84,6 +88,8 @@ phpmyadmin with pinpoint-php v0.2|398.26ms
MTT: Mean RTT Time
```

> [ pinpoint-php on Flraum test result ](../DOC/PHP/User%20Manual.md#11-performance-result)
> By the way, pinpoint is an APM system but not a performance enhancement system. The loss can't be avoided at present.

Expand Down
15 changes: 15 additions & 0 deletions PHP/pinpoint_php_example/Plugins/ClassMapInFile.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
<?php
#-------------------------------------------------------------------------------
# Copyright 2019 NAVER Corp
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy
# of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#-------------------------------------------------------------------------------

namespace Plugins;
use pinpoint\Common\AopClassMap;
Expand Down
21 changes: 15 additions & 6 deletions PHP/pinpoint_php_example/Plugins/InstancePlugins.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
<?php

#-------------------------------------------------------------------------------
# Copyright 2019 NAVER Corp
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy
# of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#-------------------------------------------------------------------------------

namespace Plugins;

Expand Down Expand Up @@ -95,11 +109,6 @@ public function __invoke()
return $this->_instance->__invoke();
}

public function __debugInfo()
{
return $this->_instance->__debugInfo();
}

public function __clone()
{
$this->_instance = clone $this->_instance;
Expand Down
19 changes: 15 additions & 4 deletions PHP/pinpoint_php_example/Plugins/PDOStatement.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
<?php

#-------------------------------------------------------------------------------
# Copyright 2019 NAVER Corp
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy
# of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#-------------------------------------------------------------------------------

namespace Plugins;
use Plugins\InstancePlugins;
Expand All @@ -17,16 +31,13 @@ protected function onBefore()
{
parent::onBefore();
#####################################
echo "--------------------------before";
pinpoint_add_clue("stp",PHP_METHOD);
pinpoint_add_clues(PHP_ARGS,print_r($this->args,true));
#####################################
}
protected function onEnd(&$ret)
{
#####################################

echo "--------------------------end";
pinpoint_add_clues(PHP_RETURN,print_r($ret,true));
#####################################
parent::onEnd($ret);
Expand Down
6 changes: 3 additions & 3 deletions PHP/pinpoint_php_example/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
```
> You could find some out of box plugins in [[pinpoint_php_example/Plugins/](https://github.com/naver/pinpoint-c-agent/tree/master/PHP/pinpoint_php_example/Plugins)].
When you add clue(clues), DO NOT assignment with large string or string included some special characters(https://www.freeformatter.com/json-escape.html)
3. Add "//@hook:app\User::adduser (which function you cared)" located right before ClassName(XXXPlugins), onBefore, onEnd or onException if you care about it when calling before&after&around, before, after or around.
3. Add "///@hook:app\User::adduser (which function you cared)" located right before ClassName(XXXPlugins), onBefore, onEnd or onException if you care about it when calling before&after&around, before, after or around.

4. Remove the "__class_index_table" file under AOP_CACHE_DIR.

Expand All @@ -44,7 +44,7 @@
7. Enjoy the pinpoint-php-agent.
## Protocol
> Json -> Thrift
> Json -> Thrift/GRPC
```
+------------------+
Expand All @@ -61,7 +61,7 @@
+----------------+
|
| thrift TCP&UDP
|
| GRPC
v
+----------------------+
| pinpoint collector |
Expand Down
5 changes: 2 additions & 3 deletions PHP/pinpoint_php_example/app/TestPDO.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class TestPDO

public function connectDb()
{echo "onbefore";
echo $dsn = 'mysql:host=dev-mysql;port=3306;dbname=yii2basic';
try{ $this->con = new PDO($dsn, "root","root");}catch (Exception $e){echo $e;}
echo $dsn = 'mysql:host=dev-mysql;port=3306;dbname=xxx';
try{ $this->con = new PDO($dsn, "","");}catch (Exception $e){echo $e;}
finally{echo "end";}}

public function getData1()
Expand Down Expand Up @@ -65,7 +65,6 @@ public function testPODStatement()

$sth->bindColumn(1, $name_out);
$sth->bindColumn(2, $code_out);
/* 通过列名绑定 */
// $sth->bindColumn('calories', $cals);

$result = $sth->fetchAll(PDO::FETCH_BOUND);
Expand Down
7 changes: 4 additions & 3 deletions PHP/pinpoint_php_example/demo/Readme.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
## The PHP frameworks that pinpoint-c-agent supports

1. Yii (https://www.yiiframework.com/)
1. [Yii-demo](./yii-demo) (https://www.yiiframework.com/)
2. laravel (https://laravel.com/)

## Some outofbox plugins for PHP applications
## Some out-of-box plugins for PHP applications

1. [Flarum demo](./Flarum-demo/Reademe.md)

1. Flarum
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ pinpoint| 1.8.0-RC1+
```ini
[Collector]
# collectorhost and specific port
### For thrift pinpoint 1.8.0-RC1+
#CollectorSpanIp=collectorHost
#CollectorSpanPort=9905
#CollectorStatIp=collectorHost
#CollectorStatPort=9906
#CollectorTcpIp=collectorHost
#CollectorTcpPort=9907
### For GRPC pinpoint 2.0+
AgentID=your_id
ApplicationName=your_name
collector.grpc.agent.ip=collectorHost
Expand Down

0 comments on commit 6a83460

Please sign in to comment.