定制 atatus/swoole-atatus 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

atatus/swoole-atatus

最新稳定版本:1.0.2

Composer 安装命令:

composer require atatus/swoole-atatus

包简介

Atatus APM monitoring for Swoole web-server

README 文档

README

Please use atatus-octane

Atatus Monitoring of Swoole (Deprecated)

This library enables monitoring of PHP applications powered by Swoole web-server via Atatus products.

Installation

The library is to be installed via Composer as a dependency:

composer require atatus/swoole-atatus

Usage

Production

Monitoring of requests from start to finish can be activated by adding a few lines of code to the server entry point. The monitoring instrumentation is by design completely transparent to an application running on the server.

Install the monitoring instrumentation for all requests:

$page = <<<HTML
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Example page</title>
</head>
<body>
    Served by Swoole server
</body>
</html>

HTML;

$server = new \Swoole\Http\Server('127.0.0.1', 8080);
$server->on('request', function ($request, $response) use ($page) {
    // PHP processing within request boundary...
    usleep(1000 * rand(100, 300));

    // Send response
    $response->end($page);

    // PHP processing outside of request boundary...
    usleep(1000 * rand(50, 150));
});

// Application performnce monitoring (APM)
$apm = new Atatus\Swoole\AtatusApm(new Atatus\Swoole\AtatusApm\TransactionFactory());
$apm->instrument($server);

unset($apm);

$server->start();

Development

Having to install the Atatus PHP extension locally may be inconvenient and outright undesirable for developers. The workaround is to replace the Atatus reporting functionality with the "stub" implementation doing nothing:

{
    "require": {
        "atatus/swoole-atatus": "*",
        ...
    }
}

Limitations

Concurrent requests subject to coroutine multi-tasking are reported as part of the first in-flight transaction.

Contributing

Pull Requests with fixes and improvements are welcome!

License

Licensed under the Apache License, Version 2.0.

统计信息

  • 总下载量: 15
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2024-03-11