https://github.com/wieni/saloon-aws-xray
https://github.com/wieni/saloon-aws-xray
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/wieni/saloon-aws-xray
- Owner: wieni
- Created: 2024-06-21T19:49:58.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-07-02T16:34:58.000Z (11 months ago)
- Last Synced: 2025-02-10T09:04:57.552Z (3 months ago)
- Language: PHP
- Size: 6.84 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
Awesome Lists containing this project
README
# AWS X-Ray integration for Saloon
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
```bash
composer require wieni/saloon-aws-xray
```## Configuration
### Laravel
When using Laravel, this package plays nicely with [napp/xray-laravel](https://github.com/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.
```php
// app/Providers/SaloonXrayServiceProvider.php
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`:
```diff
// config/app.php
'providers' => [
// ...
+ App\Providers\SaloonXrayServiceProvider::class,
// ...
],
```