ultimate-apm/ultimate-php
Composer 安装命令:
composer require ultimate-apm/ultimate-php
包简介
Monitoring Package
关键字:
README 文档
README
Simple code execution monitoring and bug reporting for PHP developers.
Requirements
- PHP >= 7.2.0
Install
Install the latest version of our package by:
composer require ultimate-apm/ultimate-php
Use
To start sending data to Palzin APM you need an BUGTRAP Key to create an instance of the Configuration class.
You can obtain ULTIMATE_BUGTRAP_KEY creating a new project in your Palzin APM dashboard.
use Ultimate\Ultimate; use Ultimate\Configuration; $configuration = new Configuration('YOUR_BUGTRAP_KEY'); $ultimate = new Ultimate($configuration);
All start with a transaction. Transaction represent an execution cycle and it can contains one or hundred of segments:
// Start an execution cycle with a transaction $ultimate->startTransaction($_SERVER['PATH_INFO']);
Use addSegment method to monitor a code block in your transaction:
$result = $ultimate->addSegment(function ($segment) { // Do something here... return "Hello World!"; }, 'my-process'); echo $result; // this will print "Hello World!"
Palzin APM will monitor your code execution in real time and keep alerting you if something goes wrong.
Custom Transport
You can also set up custom transport class to transfer monitoring data from your server to Palzin APM in a personalized way.
The transport class needs to implement \Ultimate\Transports\TransportInterface:
class CustomTransport implements \Ultimate\Transports\TransportInterface { protected $configuration; protected $queue = []; public function __constructor($configuration) { $this->configuration = $configuration; } public function addEntry(\Ultimate\Models\Arrayable $entry) { // Add an \Ultimate\Models\Arrayable entry in the queue. $this->queue[] = $entry; } public function flush() { // Performs data transfer. $handle = curl_init('https://www.palzin.app'); curl_setopt($handle, CURLOPT_POST, 1); curl_setopt($handle, CURLOPT_HTTPHEADER, [ 'X-Ultimate-Key: xxxxxxxxxxxx', 'Content-Type: application/json', 'Accept: application/json', ]); curl_setopt($handle, CURLOPT_POSTFIELDS, json_encode($this->queue)); curl_exec($handle); curl_close($handle); } }
Then you can set the new transport in the Ultimate instance
using a callback the will receive the current configuration state as parameter.
$ultimate->setTransport(function ($configuration) { return new CustomTransport($configuration); });
LICENSE
This package is licensed under the MIT license.
ultimate-apm/ultimate-php 适用场景与选型建议
ultimate-apm/ultimate-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 68 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 11 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「monitoring」 「ultimate」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ultimate-apm/ultimate-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ultimate-apm/ultimate-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ultimate-apm/ultimate-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Symfony bundle for chameleon-system/sanitycheck
SoftWax Health Check Bundle for Symfony framework
1Pilot client for Symfony
Ultipro SDK for PHP (Unofficial)
Statsd (Object Oriented) client library for PHP
APM agent for laravel projects to monitor the application with elastic apm tools.
统计信息
- 总下载量: 68
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-11-01