chocofamilyme/laravel-jaeger
Composer 安装命令:
composer require chocofamilyme/laravel-jaeger
包简介
Jaeger wrapper for Laravel
README 文档
README
Requirements
- PHP ^8.0
- Laravel ^9.0
Installation
You can install the package via composer:
composer require chocofamilyme/laravel-jaeger
You can publish the config file with:
php artisan vendor:publish --provider="Chocofamilyme\LaravelJaeger\LaravelJaegerServiceProvider" --tag="config"
Basic Usage
- You need to inject
\Chocofamilyme\LaravelJaeger\Jaegerclass by DI - Start new span by command
$jaeger->start('Some operation', [ 'tag1' => 'test', 'tag2' => 'test' ]);
- do some stuff
- (optional) stop span
$jaeger->stop('Some operation', [ 'tag3' => 'test', ]);
All unstopped spans will be automatically stopped when application is terminated
Controlling the rate of traces
In the configuration file you may modify JAEGER_SAMPLE_RATE variable to configure the rate. The variable accepts values from 0 to 1.
For example, if you set 0.1 then only 10% of all traces is displayed. Set 1 to output them all.
Listeners
There are 4 available listeners, they are disabled by default, you can turn on or write your own implementation for this listeners in config file
'listeners' => [ 'http' => [ 'enabled' => env('JAEGER_HTTP_LISTENER_ENABLED', false), 'handler' => \Chocofamilyme\LaravelJaeger\JaegerMiddleware::class, ], 'console' => [ 'enabled' => env('JAEGER_CONSOLE_LISTENER_ENABLED', false), 'handler' => \Chocofamilyme\LaravelJaeger\Listeners\CommandListener::class, ], 'query' => [ 'enabled' => env('JAEGER_QUERY_LISTENER_ENABLED', false), 'handler' => \Chocofamilyme\LaravelJaeger\Listeners\QueryListener::class, ], 'job' => [ 'enabled' => env('JAEGER_JOB_LISTENER_ENABLED', false), 'handler' => \Chocofamilyme\LaravelJaeger\Listeners\JobListener::class, ], ]
- Http - Start new span for every http request
- Console - Start new span for every running artisan console commands
- Query - Start new span for every executed database query
- Job - Start new span for every dispatched queue job
Testing
composer test
Changelog
Read changelog here
License
The MIT License (MIT). Please see License File for more information.
chocofamilyme/laravel-jaeger 适用场景与选型建议
chocofamilyme/laravel-jaeger 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 39.7k 次下载、GitHub Stars 达 18, 最近一次更新时间为 2021 年 06 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 chocofamilyme/laravel-jaeger 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 chocofamilyme/laravel-jaeger 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 39.7k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 18
- 点击次数: 12
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-06-03