Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/atatus/swoole-atatus
Atatus APM for Swoole web-server
https://github.com/atatus/swoole-atatus
Last synced: about 2 months ago
JSON representation
Atatus APM for Swoole web-server
- Host: GitHub
- URL: https://github.com/atatus/swoole-atatus
- Owner: atatus
- License: apache-2.0
- Created: 2024-03-11T11:37:04.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2024-04-17T09:51:15.000Z (9 months ago)
- Last Synced: 2024-09-18T14:50:20.767Z (4 months ago)
- Language: PHP
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# DEPRECATED
## Please use [atatus-octane](https://github.com/atatus/atatus-octane)
Atatus Monitoring of Swoole (Deprecated)
==============================This library enables monitoring of PHP applications powered by [Swoole](https://openswoole.com/) web-server via [Atatus](https://www.atatus.com/) products.
## Installation
The library is to be installed via [Composer](https://getcomposer.org/) as a dependency:
```bash
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:
```php$page = <<
Example pageServed by Swoole server
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:```json
{
"require": {
"atatus/swoole-atatus": "*",
...
}
}
```## Limitations
Concurrent requests subject to [coroutine](https://www.swoole.co.uk/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.