Remove deprecated component swoole-tracker (#6244)

This commit is contained in:
Lu Fei 2023-10-31 21:32:14 -05:00 committed by GitHub
parent eab411bdd9
commit 29959f38af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 7 additions and 301 deletions

View File

@ -72,6 +72,7 @@
- [#5859](https://github.com/hyperf/hyperf/pull/5859) Removed string cache from `Hyperf\Stringable\Str`
- [#6040](https://github.com/hyperf/hyperf/pull/6040) Removed some deprecated methods from `Hyperf\Di\Annotation\AbstractAnnotation`.
- [#6043](https://github.com/hyperf/hyperf/pull/6043) Removed deprecated `Hyperf\Coroutine\Traits\Container`.
- [#6244](https://github.com/hyperf/hyperf/pull/6244) Removed deprecated component `swoole-tracker`.
## Changed

View File

@ -18,7 +18,7 @@
Hyperf 是一个高性能、高灵活性的渐进式 PHP 协程框架,内置协程服务器及大量常用的组件,性能较传统基于 `PHP-FPM` 的框架有质的提升,提供超高性能的同时,也保持着极其灵活的可扩展性,标准组件均基于 [PSR 标准](https://www.php-fig.org/psr) 实现,基于强大的依赖注入设计,保证了绝大部分组件或类都是 `可替换``可复用` 的。
框架组件库除了常见的协程版的 `MySQL 客户端`、`Redis 客户端`,还为您准备了协程版的 `Eloquent ORM`、`WebSocket 服务端及客户端`、`JSON RPC 服务端及客户端`、`GRPC 服务端及客户端`、`Zipkin/Jaeger (OpenTracing) 客户端`、`Guzzle HTTP 客户端`、`Elasticsearch 客户端`、`Consul 客户端`、`ETCD 客户端`、`AMQP 组件`、`NSQ 组件`、`Nats 组件`、`Apollo 配置中心`、`阿里云 ACM 应用配置管理`、`ETCD 配置中心`、`基于令牌桶算法的限流器`、`通用连接池`、`熔断器`、`Swagger 文档生成`、`Swoole Tracker`、`视图引擎`、`Snowflake 全局 ID 生成器` 等组件,省去了自己实现对应协程版本的麻烦。
框架组件库除了常见的协程版的 `MySQL 客户端`、`Redis 客户端`,还为您准备了协程版的 `Eloquent ORM`、`WebSocket 服务端及客户端`、`JSON RPC 服务端及客户端`、`GRPC 服务端及客户端`、`Zipkin/Jaeger (OpenTracing) 客户端`、`Guzzle HTTP 客户端`、`Elasticsearch 客户端`、`Consul 客户端`、`ETCD 客户端`、`AMQP 组件`、`NSQ 组件`、`Nats 组件`、`Apollo 配置中心`、`阿里云 ACM 应用配置管理`、`ETCD 配置中心`、`基于令牌桶算法的限流器`、`通用连接池`、`熔断器`、`Swagger 文档生成`、`视图引擎`、`Snowflake 全局 ID 生成器` 等组件,省去了自己实现对应协程版本的麻烦。
Hyperf 还提供了 `基于 PSR-11 的依赖注入容器`、`注解`、`AOP 面向切面编程`、`基于 PSR-15 的中间件`、`自定义进程`、`基于 PSR-14 的事件管理器`、`Redis/RabbitMQ/NSQ/Nats 消息队列`、`自动模型缓存`、`基于 PSR-16 的缓存`、`Crontab 秒级定时任务`、`Translation 国际化`、`Validation 验证器` 等非常便捷的功能,满足丰富的技术场景和业务场景,开箱即用。

View File

@ -18,7 +18,7 @@ English | [中文](./README-CN.md)
Hyperf is an extremely performant and flexible PHP CLI framework, powered by a state-of-the-art coroutine server and a large number of battle-tested components. Aside from decisively beating PHP-FPM frameworks in benchmarks, Hyperf is unique in its focus on flexibility and composition. Hyperf ships with an AOP-enabling (aspect-oriented programming) dependency injector to ensure components and classes are pluggable and meta-programmable. All of Hyperf's core components strictly follow [PSR](https://www.php-fig.org/psr) standards and can be used in other frameworks.
Hyperf's architecture is built using a combination of `Coroutines`, `Dependency injection`, `Events`, `Annotations`, and `AOP`. In addition to providing `MySQL`, `Redis` and other common coroutine clients, `Hyperf` also provides coroutine compatible versions of `WebSocket server / client`, `JSON RPC server / client`, `gRPC server / client`, `Zipkin/Jaeger (OpenTracing) client`, `Guzzle HTTP client`, `Elasticsearch client`, `Consul client`, `ETCD client`, `AMQP component`, `Apollo configuration center`, `Aliyun ACM`, `ETCD configuration center`, `Token bucket algorithm-based limiter`, `Universal connection pool`, `Circuit breaker`, `Swagger`, `Swoole Tracker`, `Snowflake`, `Simply Redis MQ`, `RabbitMQ`, `NSQ`, `Nats`, `Seconds level crontab`, `Custom Processes`, etc. Therefore, developers can entirely avoid implementing coroutine compatible versions of these libraries.
Hyperf's architecture is built using a combination of `Coroutines`, `Dependency injection`, `Events`, `Annotations`, and `AOP`. In addition to providing `MySQL`, `Redis` and other common coroutine clients, `Hyperf` also provides coroutine compatible versions of `WebSocket server / client`, `JSON RPC server / client`, `gRPC server / client`, `Zipkin/Jaeger (OpenTracing) client`, `Guzzle HTTP client`, `Elasticsearch client`, `Consul client`, `ETCD client`, `AMQP component`, `Apollo configuration center`, `Aliyun ACM`, `ETCD configuration center`, `Token bucket algorithm-based limiter`, `Universal connection pool`, `Circuit breaker`, `Swagger`, `Snowflake`, `Simply Redis MQ`, `RabbitMQ`, `NSQ`, `Nats`, `Seconds level crontab`, `Custom Processes`, etc. Therefore, developers can entirely avoid implementing coroutine compatible versions of these libraries.
Rest assured, Hyperf is still a PHP framework. Hyperf provides all the packages you expect: `Middleware`, `Event Manager`, `Coroutine-optimized Eloquent ORM` (and Model Cache!), `Translation`, `Validation`, `View engine (Blade/Smarty/Twig/Plates/ThinkTemplate)` and more.

View File

@ -188,7 +188,6 @@
"hyperf/super-globals": "*",
"hyperf/support": "*",
"hyperf/swagger": "*",
"hyperf/swoole-tracker": "*",
"hyperf/tappable": "*",
"hyperf/task": "*",
"hyperf/testing": "*",
@ -309,7 +308,6 @@
"Hyperf\\SuperGlobals\\": "src/super-globals/src/",
"Hyperf\\Support\\": "src/support/src/",
"Hyperf\\Swagger\\": "src/swagger/src/",
"Hyperf\\SwooleTracker\\": "src/swoole-tracker/src/",
"Hyperf\\Tappable\\": "src/tappable/src/",
"Hyperf\\Task\\": "src/task/src/",
"Hyperf\\Testing\\": "src/testing/src/",
@ -512,7 +510,6 @@
"Hyperf\\Socket\\ConfigProvider",
"Hyperf\\SuperGlobals\\ConfigProvider",
"Hyperf\\Swagger\\ConfigProvider",
"Hyperf\\SwooleTracker\\ConfigProvider",
"Hyperf\\Task\\ConfigProvider",
"Hyperf\\Tracer\\ConfigProvider",
"Hyperf\\Translation\\ConfigProvider",

View File

@ -2,7 +2,7 @@
Hyperf is an extremely performant and flexible PHP CLI framework, powered by a state-of-the-art coroutine server and a large number of battle-tested components. Aside from decisively beating PHP-FPM frameworks in benchmarks, Hyperf is unique in its focus on flexibility and composition. Hyperf ships with an AOP-enabling (aspect-oriented programming) dependency injector to ensure components and classes are pluggable and meta-programmable. All of Hyperf's core components strictly follow [PSR](https://www.php-fig.org/psr) standards and can be used in other frameworks.
Hyperf's architecture is built using a combination of `Coroutines`, `Dependency injection`, `Events`, `Annotations`, and `AOP`. In addition to providing `MySQL`, `Redis` and other common coroutine clients, `Hyperf` also provides coroutine compatible versions of `WebSocket server / client`, `JSON RPC server / client`, `gRPC server / client`, `Zipkin/Jaeger (OpenTracing) client`, `Guzzle HTTP client`, `Elasticsearch client`, `Consul client`, `ETCD client`, `AMQP component`, `Apollo configuration center`, `Aliyun ACM`, `ETCD configuration center`, `Token bucket algorithm-based limiter`, `Universal connection pool`, `Circuit breaker`, `Swagger`, `Swoole Tracker`, `Snowflake`, `Simply Redis MQ`, `RabbitMQ`, `NSQ`, `Nats`, `Seconds level crontab`, `Custom Processes`, etc. Therefore, developers can entirely avoid implementing coroutine compatible versions of these libraries.
Hyperf's architecture is built using a combination of `Coroutines`, `Dependency injection`, `Events`, `Annotations`, and `AOP`. In addition to providing `MySQL`, `Redis` and other common coroutine clients, `Hyperf` also provides coroutine compatible versions of `WebSocket server / client`, `JSON RPC server / client`, `gRPC server / client`, `Zipkin/Jaeger (OpenTracing) client`, `Guzzle HTTP client`, `Elasticsearch client`, `Consul client`, `ETCD client`, `AMQP component`, `Apollo configuration center`, `Aliyun ACM`, `ETCD configuration center`, `Token bucket algorithm-based limiter`, `Universal connection pool`, `Circuit breaker`, `Swagger`, `Snowflake`, `Simply Redis MQ`, `RabbitMQ`, `NSQ`, `Nats`, `Seconds level crontab`, `Custom Processes`, etc. Therefore, developers can entirely avoid implementing coroutine compatible versions of these libraries.
Rest assured, Hyperf is still a PHP framework. Hyperf provides all the packages you expect: `Middleware`, `Event Manager`, `Coroutine-optimized Eloquent ORM` (and Model Cache!), `Translation`, `Validation`, `View engine (Blade/Smarty/Twig/Plates/ThinkTemplate)` and more.

View File

@ -2,7 +2,7 @@
Hyperf 是一个高性能、高灵活性的渐进式 PHP 协程框架,内置协程服务器及大量常用的组件,性能较传统基于 `PHP-FPM` 的框架有质的提升,提供超高性能的同时,也保持着极其灵活的可扩展性,标准组件均基于 [PSR 标准](https://www.php-fig.org/psr) 实现,基于强大的依赖注入设计,保证了绝大部分组件或类都是 `可替换``可复用` 的。
框架组件库除了常见的协程版的 `MySQL 客户端`、`Redis 客户端`,还为您准备了协程版的 `Eloquent ORM`、`WebSocket 服务端及客户端`、`JSON RPC 服务端及客户端`、`GRPC 服务端及客户端`、`Zipkin/Jaeger (OpenTracing) 客户端`、`Guzzle HTTP 客户端`、`Elasticsearch 客户端`、`Consul 客户端`、`ETCD 客户端`、`AMQP 组件`、`Apollo 配置中心`、`阿里云 ACM 应用配置管理`、`ETCD 配置中心`、`基于令牌桶算法的限流器`、`通用连接池`、`熔断器`、`Swagger 文档生成`、`Swoole Tracker`、`视图引擎`、`Snowflake 全局 ID 生成器` 等组件,省去了自己实现对应协程版本的麻烦。
框架组件库除了常见的协程版的 `MySQL 客户端`、`Redis 客户端`,还为您准备了协程版的 `Eloquent ORM`、`WebSocket 服务端及客户端`、`JSON RPC 服务端及客户端`、`GRPC 服务端及客户端`、`Zipkin/Jaeger (OpenTracing) 客户端`、`Guzzle HTTP 客户端`、`Elasticsearch 客户端`、`Consul 客户端`、`ETCD 客户端`、`AMQP 组件`、`Apollo 配置中心`、`阿里云 ACM 应用配置管理`、`ETCD 配置中心`、`基于令牌桶算法的限流器`、`通用连接池`、`熔断器`、`Swagger 文档生成`、`视图引擎`、`Snowflake 全局 ID 生成器` 等组件,省去了自己实现对应协程版本的麻烦。
Hyperf 还提供了 `基于 PSR-11 的依赖注入容器`、`注解`、`AOP 面向切面编程`、`基于 PSR-15 的中间件`、`自定义进程`、`基于 PSR-14 的事件管理器`、`Redis/RabbitMQ 消息队列`、`自动模型缓存`、`基于 PSR-16 的缓存`、`Crontab 秒级定时任务`、`国际化`、`Validation 表单验证器` 等非常便捷的功能,满足丰富的技术场景和业务场景,开箱即用。

View File

@ -2,7 +2,7 @@
Hyperf 是一個高性能、高靈活性的漸進式 PHP 協程框架,內置協程服務器及大量常用的組件,性能較傳統基於 `PHP-FPM` 的框架有質的提升,提供超高性能的同時,也保持着極其靈活的可擴展性,標準組件均基於 [PSR 標準](https://www.php-fig.org/psr) 實現,基於強大的依賴注入設計,保證了絕大部分組件或類都是 `可替換``可複用` 的。
框架組件庫除了常見的協程版的 `MySQL 客户端`、`Redis 客户端`,還為您準備了協程版的 `Eloquent ORM`、`WebSocket 服務端及客户端`、`JSON RPC 服務端及客户端`、`GRPC 服務端及客户端`、`Zipkin/Jaeger (OpenTracing) 客户端`、`Guzzle HTTP 客户端`、`Elasticsearch 客户端`、`Consul 客户端`、`ETCD 客户端`、`AMQP 組件`、`Apollo 配置中心`、`阿里雲 ACM 應用配置管理`、`ETCD 配置中心`、`基於令牌桶算法的限流器`、`通用連接池`、`熔斷器`、`Swagger 文檔生成`、`Swoole Tracker`、`視圖引擎`、`Snowflake 全局 ID 生成器` 等組件,省去了自己實現對應協程版本的麻煩。
框架組件庫除了常見的協程版的 `MySQL 客户端`、`Redis 客户端`,還為您準備了協程版的 `Eloquent ORM`、`WebSocket 服務端及客户端`、`JSON RPC 服務端及客户端`、`GRPC 服務端及客户端`、`Zipkin/Jaeger (OpenTracing) 客户端`、`Guzzle HTTP 客户端`、`Elasticsearch 客户端`、`Consul 客户端`、`ETCD 客户端`、`AMQP 組件`、`Apollo 配置中心`、`阿里雲 ACM 應用配置管理`、`ETCD 配置中心`、`基於令牌桶算法的限流器`、`通用連接池`、`熔斷器`、`Swagger 文檔生成`、`視圖引擎`、`Snowflake 全局 ID 生成器` 等組件,省去了自己實現對應協程版本的麻煩。
Hyperf 還提供了 `基於 PSR-11 的依賴注入容器`、`註解`、`AOP 面向切面編程`、`基於 PSR-15 的中間件`、`自定義進程`、`基於 PSR-14 的事件管理器`、`Redis/RabbitMQ 消息隊列`、`自動模型緩存`、`基於 PSR-16 的緩存`、`Crontab 秒級定時任務`、`國際化`、`Validation 表單驗證器` 等非常便捷的功能,滿足豐富的技術場景和業務場景,開箱即用。

View File

@ -2,7 +2,7 @@
Hyperf 是一個高效能、高靈活性的漸進式 PHP 協程框架,內建協程伺服器及大量常用的元件,效能較傳統基於 `PHP-FPM` 的框架有質的提升,提供超高效能的同時,也保持著極其靈活的可擴充套件性,標準組件均基於 [PSR 標準](https://www.php-fig.org/psr) 實現,基於強大的依賴注入設計,保證了絕大部分元件或類都是 `可替換``可複用` 的。
框架元件庫除了常見的協程版的 `MySQL 客戶端`、`Redis 客戶端`,還為您準備了協程版的 `Eloquent ORM`、`WebSocket 服務端及客戶端`、`JSON RPC 服務端及客戶端`、`GRPC 服務端及客戶端`、`Zipkin/Jaeger (OpenTracing) 客戶端`、`Guzzle HTTP 客戶端`、`Elasticsearch 客戶端`、`Consul 客戶端`、`ETCD 客戶端`、`AMQP 元件`、`Apollo 配置中心`、`阿里雲 ACM 應用配置管理`、`ETCD 配置中心`、`基於令牌桶演算法的限流器`、`通用連線池`、`熔斷器`、`Swagger 文件生成`、`Swoole Tracker`、`檢視引擎`、`Snowflake 全域性 ID 生成器` 等元件,省去了自己實現對應協程版本的麻煩。
框架元件庫除了常見的協程版的 `MySQL 客戶端`、`Redis 客戶端`,還為您準備了協程版的 `Eloquent ORM`、`WebSocket 服務端及客戶端`、`JSON RPC 服務端及客戶端`、`GRPC 服務端及客戶端`、`Zipkin/Jaeger (OpenTracing) 客戶端`、`Guzzle HTTP 客戶端`、`Elasticsearch 客戶端`、`Consul 客戶端`、`ETCD 客戶端`、`AMQP 元件`、`Apollo 配置中心`、`阿里雲 ACM 應用配置管理`、`ETCD 配置中心`、`基於令牌桶演算法的限流器`、`通用連線池`、`熔斷器`、`Swagger 文件生成`、`檢視引擎`、`Snowflake 全域性 ID 生成器` 等元件,省去了自己實現對應協程版本的麻煩。
Hyperf 還提供了 `基於 PSR-11 的依賴注入容器`、`註解`、`AOP 面向切面程式設計`、`基於 PSR-15 的中介軟體`、`自定義程序`、`基於 PSR-14 的事件管理器`、`Redis/RabbitMQ 訊息佇列`、`自動模型快取`、`基於 PSR-16 的快取`、`Crontab 秒級定時任務`、`國際化`、`Validation 表單驗證器` 等非常便捷的功能,滿足豐富的技術場景和業務場景,開箱即用。

View File

@ -49,8 +49,6 @@ parameters:
- '#Function get_debug_type invoked with 1 parameter, 0 required#'
- '#Call to an undefined method Hyperf\\Utils\\HigherOrderCollectionProxy::.*#'
- '#InfluxDB\\Point constructor expects float\|null, string given#'
- '#getSwooleTracker.* not found#'
- '#trackerHookMalloc not found#'
- '#separator of function explode expects non-empty-string, string given#'
- '#While loop condition is always true#'
- '#Unsafe access to private property .* through static::#'

View File

@ -1,2 +0,0 @@
/tests export-ignore
/.github export-ignore

View File

@ -1,13 +0,0 @@
name: Close Pull Request
on:
pull_request_target:
types: [opened]
jobs:
run:
runs-on: ubuntu-latest
steps:
- uses: superbrothers/close-pull-request@v3
with:
comment: "Hi, this is a READ-ONLY repository, please submit your PR on the https://github.com/hyperf/hyperf repository.<br><br> This Pull Request will close automatically.<br><br> Thanks! "

View File

@ -1,25 +0,0 @@
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
name: Release
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

View File

@ -1,21 +0,0 @@
The MIT License (MIT)
Copyright (c) Hyperf
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,31 +0,0 @@
# Swoole Tracker
[Swoole Tracker](https://business.swoole.com/tracker/index)作为`Swoole`官方出品的一整套企业级`PHP`和`Swoole`分析调试工具,更专一、更专业。
* 时刻掌握应用架构模型
> 自动发现应用依赖拓扑结构和展示,时刻掌握应用的架构模型
* 分布式跨应用链路追踪
> 支持无侵入的分布式跨应用链路追踪,让每个请求一目了然,全面支持协程/非协程环境,数据实时可视化
* 全面分析报告服务状况
> 各种维度统计服务上报的调用信息, 比如总流量、平均耗时、超时率等,并全面分析报告服务状况
* 拥有强大的调试工具链
> 本系统支持远程调试,可在系统后台远程开启检测内存泄漏、阻塞检测和代码性能分析
* 同时支持FPM和Swoole
> 完美支持PHP-FPM环境不仅限于在Swoole中使用
* 完善的系统监控
> 支持完善的系统监控零成本部署监控机器的CPU、内存、网络、磁盘等资源可以很方便的集成到现有报警系统
* 零成本接入系统
> 本系统的客户端提供脚本可一键部署服务端可在Docker环境中运行简单快捷

View File

@ -1,45 +0,0 @@
{
"name": "hyperf/swoole-tracker",
"description": "A swoole tracker library for Hyperf.",
"license": "MIT",
"keywords": [
"php",
"swoole",
"hyperf",
"swoole-tracker"
],
"homepage": "https://hyperf.io",
"support": {
"docs": "https://hyperf.wiki",
"issues": "https://github.com/hyperf/hyperf/issues",
"pull-request": "https://github.com/hyperf/hyperf/pulls",
"source": "https://github.com/hyperf/hyperf"
},
"require": {
"php": ">=8.1",
"hyperf/contract": "~3.1.0",
"hyperf/support": "~3.1.0",
"hyperf/utils": "~3.1.0",
"psr/container": "^1.0|^2.0",
"psr/http-server-middleware": "^1.0"
},
"autoload": {
"psr-4": {
"Hyperf\\SwooleTracker\\": "src/"
}
},
"autoload-dev": {
"psr-4": {}
},
"config": {
"sort-packages": true
},
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
},
"hyperf": {
"config": "Hyperf\\SwooleTracker\\ConfigProvider"
}
}
}

View File

@ -1,49 +0,0 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\SwooleTracker\Aspect;
use Hyperf\Di\Aop\AbstractAspect;
use Hyperf\Di\Aop\ProceedingJoinPoint;
use Hyperf\Guzzle\CoroutineHandler;
use Psr\Container\ContainerInterface;
use Swoole\Coroutine\Http\Client;
use SwooleTracker\Stats;
use function getSwooleTrackerSpanId;
use function getSwooleTrackerTraceId;
class CoroutineHandlerAspect extends AbstractAspect
{
public array $classes = [
CoroutineHandler::class . '::execute',
];
public function __construct(protected ContainerInterface $container)
{
}
public function process(ProceedingJoinPoint $proceedingJoinPoint)
{
if (class_exists(Stats::class) && $client = $proceedingJoinPoint->getArguments()[0] ?? null) {
if ($client instanceof Client && function_exists('getSwooleTrackerTraceId') && function_exists('getSwooleTrackerSpanId')) {
$client->setHeaders(array_merge(
[
'x-swoole-traceid' => getSwooleTrackerTraceId(),
'x-swoole-spanid' => getSwooleTrackerSpanId(),
],
$client->requestHeaders
));
}
}
return $proceedingJoinPoint->process();
}
}

View File

@ -1,20 +0,0 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\SwooleTracker;
class ConfigProvider
{
public function __invoke(): array
{
return [];
}
}

View File

@ -1,30 +0,0 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\SwooleTracker\Middleware;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
use function trackerHookMalloc;
class HookMallocMiddleware implements MiddlewareInterface
{
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
if (function_exists('trackerHookMalloc')) {
trackerHookMalloc();
}
return $handler->handle($request);
}
}

View File

@ -1,54 +0,0 @@
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace Hyperf\SwooleTracker\Middleware;
use Hyperf\Contract\ConfigInterface;
use Hyperf\Support\Network;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
use SwooleTracker\Stats;
use Throwable;
class HttpServerMiddleware implements MiddlewareInterface
{
protected ?string $name = null;
public function __construct(ConfigInterface $config)
{
$this->name = $config->get('app_name', 'hyperf-skeleton');
}
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
if (class_exists(Stats::class)) {
$path = $request->getUri()->getPath();
$ip = Network::ip();
$traceId = $request->getHeaderLine('x-swoole-traceid') ?: '';
$spanId = $request->getHeaderLine('x-swoole-spanid') ?: '';
$tick = Stats::beforeExecRpc($path, $this->name, $ip, $traceId, $spanId);
try {
$response = $handler->handle($request);
Stats::afterExecRpc($tick, true, $response->getStatusCode());
} catch (Throwable $exception) {
Stats::afterExecRpc($tick, false, $exception->getCode());
throw $exception;
}
} else {
$response = $handler->handle($request);
}
return $response;
}
}