Swoole Tracker

Swoole Tracker as Swoole official produced a set of enterprise-class PHP and Swoole analysis debugging tools, more specific, more professional.


  • Always master the application architecture model

    Automated discovery applications rely on topology and presentation to keep track of the architectural model of the application

  • Distributed cross-application link tracking

    Supports non-intrusive distributed cross-application link tracking, making each request clear at a glance, fully supporting coroutine/non-coroutine environments, real-time data visualization

  • Comprehensive analysis of reporting service status

    Calling information reported by various dimension statistics services, such as total traffic, average time consumption, timeout rate, etc., and comprehensive analysis of reporting service status

  • Has a powerful debugging tool chain

    The system supports remote debugging, and can remotely detect memory leaks, blocking detection and code performance analysis in the background of the system.

  • Complete system monitoring

    Supports complete system monitoring, zero-cost deployment, monitoring of the machine's CPU, memory, network, disk and other resources, can be easily integrated into the existing alarm system

  • Zero cost access system

    The client of the system provides scripts that can be deployed in one click, and the server can run in the Docker environment, which is simple and fast.


Installation dependency

After registering the account, enter the console and apply for a trial to download the corresponding client.

Related documents, please try the trial document or detailed documentation

The specific document address, which is displayed in the corresponding client downloaded from the console.

Copy all the files in the client and the following two files to the project directory swoole-tacker

  1. entrypoint.sh
 #!/usr/bin/env bash

/opt/swoole/script/php/swoole_php /opt/swoole/node-agent/src/node.php &

php /var/www/swoft/bin/swoft http:start

Then copy the Dockerfile below into the project root directory.

 FROM swoft/swoft

LABEL maintainer="sakuraovq <sakuraovq@gmail.com>" version="2.6"

# This php version
# This is tracker ini config
ENV SWOOLE_TRACHER_INI=/usr/local/etc/php/conf.d/swoole-tracker.ini

ADD . /var/www/swoft

# The address here is displayed on the client side.
RUN  cd ./swoole-tracker && ./deploy_env.sh www.swoole-cloud.com \
    && chmod 777 entrypoint.sh \
    && php_dir=$(php -r "echo @ini_get("extension_dir").PHP_EOL;") \
    && cp ./swoole_tracker${PHP_VERSION}.so $php_dir/swoole_tracker.so \
    # Enable swoole_tracker
    && echo "extension=swoole_tracker.so" > ${SWOOLE_TRACHER_INI} \
    # Open the main switch
    && echo "apm.enable=1" >> ${SWOOLE_TRACHER_INI} \
    # Sampling Rate, eg: 10%
    && echo "apm.sampling_rate=10" >> ${SWOOLE_TRACHER_INI} \
    # Turn on memory leak detection Default 0 Off
    && echo "apm.enable_memcheck=1" >> ${SWOOLE_TRACHER_INI}

CMD ["sh", "./swoole-tracker/entrypoint.sh"] 

Build image

 docker build -t swoft/tracker . 

Running container

 docker run --rm --name swoft-tracker -v $(pwd):/var/www/swoft -p 18306:18306 swoft/tracker 

Sampling Rate

The sampling rate is configured according to requirements. If it is 100%, all requests will be reported.


Not dependent on components

Swoole Tracker support automatically generates app names and creates apps without modifying any code. The resulting app name format is:

Swoole 's HttpServer : ip:prot

Other Server : ip(hostname):prot

That is, after the swoole_tracker extension is installed, the function of Swoole Tracker can be used Swoole Tracker .

Dependent component

When you need to customize the app name, you need to install the component and install it using Composer :

Installation component

 composer require swoft/swoole-tracker 

After the installation is complete, register the Swoft\Swoole\Tracker\Middleware\SwooleTrackerMiddleware middleware in the app/bean.php configuration file, as follows:


return [
       'httpDispatcher'    => [
           // Add global http middleware
           'middlewares' => [

The link tracking is automatically turned on when the middleware is configured.

Use alone

You can also use it separately when you need a link trace to 透传TraceId/SpanId to 自定义应用名称 , for example:

 /** @var SwooleTracker $swooleTracker */
$swooleTracker = bean(SwooleTracker::class);

 * 参数说明:
 * 1. $func eg. 'App\Login\Weibo::login'
 * 2. $serviceName 自定义的应用名称,后台会自动创建 eg. 'user'
 * 3. $serverIp eg. ''
 * 4. $traceId
 * 5. $spanId
$tick = $swooleTracker->startRpcAnalysis('/get/user', 'demo', '', $traceId, $spanId);

// todo ...
$handlerStatus = false;
$errno         = 401;

$swooleTracker->endRpcAnalysis($tick, $handlerStatus, $errno); 

Login management background

Link tracking


Application monitoring




Memory leak


Blocking check


If you need to enable 阻塞检查 , 泄露分析 , 性能分析 in the process list is followed by the button is open, do not need the client to manually report