wieni/saloon-aws-xray
最新稳定版本:1.0.0
Composer 安装命令:
composer require wieni/saloon-aws-xray
包简介
AWS X-Ray integration for Saloon
README 文档
README
This package provides a Saloon Sender that sends traces to AWS X-Ray.
It creates a separate trace for each request and sends the trace to AWS X-Ray when the request is finished.
Installation
composer require wieni/saloon-aws-xray
Configuration
Laravel
When using Laravel, this package plays nicely with napp/xray-laravel.
Please read the documentation of that package to configure AWS X-Ray for Laravel.
You can then create a ServiceProvider to configure Saloon to use the AWS X-Ray sender.
// app/Providers/SaloonXrayServiceProvider.php <?php declare(strict_types=1); namespace App\Providers; use Illuminate\Support\ServiceProvider; use Napp\Xray\Submission\DaemonSegmentSubmitter; use Napp\Xray\Xray; use Saloon\Config as SaloonConfig; use Saloon\HttpSender\HttpSender; use Wieni\SaloonAwsXray\XrayHttpSender; final class SaloonXrayServiceProvider extends ServiceProvider { public function register(): void { // Configure the XrayHttpSender $this->app->bind( XrayHttpSender::class, function (): XrayHttpSender { $submitterClass = config('xray.submitter', DaemonSegmentSubmitter::class); $senderClass = config('saloon.default_sender', HttpSender::class); return new XrayHttpSender( new $senderClass(), $this->app[Xray::class]->tracer(), new $submitterClass(), ); }, ); // Configure Saloon to use the XrayHttpSender SaloonConfig::setSenderResolver(fn() => $this->app[XrayHttpSender::class]); } }
And register the ServiceProvider in your config/app.php:
// config/app.php
'providers' => [
// ...
+ App\Providers\SaloonXrayServiceProvider::class,
// ...
],
统计信息
- 总下载量: 140
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-06-22