PHP code example of extraswoft / jaeger
1. Go to this page and download the library: Download extraswoft/jaeger library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
extraswoft / jaeger example snippets
"minimum-stability": "dev",
"prefer-stable": true,
composer
'beanScan' => [
"ExtraSwoft\\Jaeger\\",
],
'serverDispatcher' => [
'middlewares' => [
\Swoft\View\Middleware\ViewMiddleware::class,
JaegerMiddleware::class,
// \Swoft\Devtool\Middleware\DevToolMiddleware::class,
// \Swoft\Session\Middleware\SessionMiddleware::class,
]
],
#jaeger
JAEGER_RATE=1
JAEGER_SERVER_HOST=172.21.134.20:6831
JAEGER_OPEN=true
JAEGER_MODE=2
ENV=test
$client = new Client(['adapter' => new AddJaegerAdapter()]);
Log::profileStart($profileKey);
+ App::trigger('Mysql', 'start', $profileKey, $sql);
$connection->prepare($sql);
$params = self::transferParams($params);
$result = $connection->execute($params);
$this->release();
Log::profileEnd($this->profileKey);
+ App::trigger('Mysql', 'end', $this->profileKey, true);
return $result;
$connectPool = App::getPool($this->poolName);
/* @var ConnectionInterface $client */
$connection = $connectPool->getConnection();
+ App::trigger('Redis', 'start', $method, $params);
$result = $connection->$method(...$params);
$connection->release(true);
+ App::trigger('Redis', 'end', true);
return $result;
if ($query !== '') $path .= '?' . $query;
$client->setDefer();
+ App::trigger('HttpClient', 'start', $request, $options);
$client->execute($path);
App::profileEnd($profileKey);
$response = $this->createResponse()
->withBody(new SwooleStream($result ?? ''))
->withHeaders($headers ?? [])
->withStatus($this->deduceStatusCode($client));
App::trigger('HttpClient', 'end', $response);
return $response;
else if ($throwable instanceof MysqlException) {
App::trigger('Mysql', 'end', 'all', false, $throwable->getMessage());
} else if ($throwable instanceof RedisException) {
App::trigger('Redis', 'end' , false, $throwable->getMessage());
}
\Swoft::getBean(TracerManager::class)->getHeader();
docker run -d -e COLLECTOR_ZIPKIN_HTTP_PORT=9411 -p5775:5775/udp -p6831:6831/udp -p6832:6832/udp \
-p5778:5778 -p16686:16686 -p14268:14268 -p9411:9411 jaegertracing/all-in-one:latest