topthink / think-tracing
Distributed tracing for ThinkPHP made easy
v1.0.12
2023-12-23 03:41 UTC
Requires
- php: >=7.1.0
- guzzlehttp/guzzle: ^7.0
- opentracing/opentracing: ^1.0
- topthink/framework: ^6.0 || ^8.0
Requires (Dev)
- jcchavezs/zipkin-opentracing: ^1.0 || ^2.0
- jonahgeorge/jaeger-client-php: ^1.0
Suggests
- jcchavezs/zipkin-opentracing: zipkin
- jonahgeorge/jaeger-client-php: jaeger
README
安装
composer require topthink/think-tracing
支持两种驱动zipkin、jaeger 分别需要安装
composer require jcchavezs/zipkin-opentracing
composer require jonahgeorge/jaeger-client-php
使用
1. 中间件
扩展内提供了think\tracing\middleware\TraceRequests
中间,配置到路由里或者全局中间件
2. 错误处理
使用了中间件后,该组件默认会跟踪到错误
配置文件里errors设置为false可以关闭
3.异步上报数据
配置
async
,数据临时存储到redis,单独起一个进程php think tracing:report
来上报数据