pccomponentes / apm-symfony-messenger
Elastic APM for Symfony Messenger
Installs: 12 631
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 6
Forks: 3
Open Issues: 0
Requires
- php: ^7.4 | ^8.0
- symfony/messenger: ^4.4|^5.0
- zoilomora/elastic-apm-agent-php: ^1.0
Requires (Dev)
This package is auto-updated.
Last update: 2024-11-14 17:23:54 UTC
README
This library supports Span traces of Symfony Messenger messages.
Installation
-
Install via composer
composer require pccomponentes/apm-symfony-messenger
Usage
In all cases, an already created instance of ElasticApmTracer is assumed.
Native PHP
<?php declare(strict_types=1); class TextNameExtractor implements PcComponentes\ElasticAPM\Symfony\Component\Messenger\NameExtractor { public function execute($message): string { if (false === is_string($message)) { throw new InvalidArgumentException('The parameter must be of type string'); } return $message; } } $apmMiddleware = new PcComponentes\ElasticAPM\Symfony\Component\Messenger\ApmMiddleware( $apmTracer, /** \ZoiloMora\ElasticAPM\ElasticApmTracer instance. */ new TextNameExtractor(), ); $bus = new Symfony\Component\Messenger\MessageBus([ $apmMiddleware ]);
Service Container (Symfony)
app.bus: class: Symfony\Component\Messenger\MessageBus arguments: $middlewareHandlers: - '@app.bus.middleware.apm' app.bus.middleware.apm: class: PcComponentes\ElasticAPM\Symfony\Component\Messenger\ApmMiddleware arguments: $elasticApmTracer: '@apm.tracer' # \ZoiloMora\ElasticAPM\ElasticApmTracer instance. $nameExtractor: '@app.bus.middleware.apm.name_extractor' app.bus.middleware.apm.name_extractor: class: ExampleTextNameExtractor
License
Licensed under the MIT license
Read LICENSE for more information