Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pccomponentes/apm-guzzle
Elastic APM for Guzzle
https://github.com/pccomponentes/apm-guzzle
apm elasticsearch guzzle guzzle-middleware guzzlehttp
Last synced: 3 months ago
JSON representation
Elastic APM for Guzzle
- Host: GitHub
- URL: https://github.com/pccomponentes/apm-guzzle
- Owner: PcComponentes
- License: mit
- Created: 2020-05-28T06:45:12.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-04-15T12:54:31.000Z (almost 4 years ago)
- Last Synced: 2024-11-05T20:04:48.497Z (3 months ago)
- Topics: apm, elasticsearch, guzzle, guzzle-middleware, guzzlehttp
- Language: PHP
- Homepage:
- Size: 8.79 KB
- Stars: 1
- Watchers: 7
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Elastic APM for Guzzle
This library supports Span traces of HTTP calls and distributed traces with [Guzzle](https://github.com/guzzle/guzzle).
## Installation
1) Install via [composer](https://getcomposer.org/)
```shell script
composer require pccomponentes/apm-guzzle
```## Usage
In all cases, an already created instance of [ElasticApmTracer](https://github.com/zoilomora/elastic-apm-agent-php) is assumed.
### Native PHP
```php
push($apmMiddleware);$config = [
'handler' => $handler,
];$client = new GuzzleHttp\Client($config);
```### Service Container (Symfony)
```yaml
http.client:
class: GuzzleHttp\Client
arguments:
$config:
handler: '@guzzle.handler'guzzle.handler:
class: GuzzleHttp\HandlerStack
factory: 'GuzzleHttp\HandlerStack::create'
calls:
- method: push
arguments: ['@guzzle.middleware.apm', 'trace']guzzle.middleware.apm:
class: Closure
factory: 'PcComponentes\ElasticAPM\GuzzleHttp\ElasticApmMiddleware::trace'
arguments:
$elasticApmTracer: '@apm.tracer' # \ZoiloMora\ElasticAPM\ElasticApmTracer instance.
```## License
Licensed under the [MIT license](http://opensource.org/licenses/MIT)Read [LICENSE](LICENSE) for more information