auxmoney/opentracing-bundle-emagtechlabs-rabbitmqbundle
Prerequisites Check:
auxmoney/opentracing-bundle-core installed and configured in your Symfony project.emag-tech-labs/rabbitmq-bundle (version ^2.0).Installation:
composer require auxmoney/opentracing-bundle-emagtechlabs-rabbitmqbundle
Enable the Bundle:
Add to config/bundles.php (Symfony 4+):
Auxmoney\OpentracingEmagtechlabsRabbitMqBundle\OpentracingEmagtechlabsRabbitMqBundle::class => ['all' => true],
First Use Case:
eMAGTechLabs/RabbitMqBundle producer.Automatic Tracing:
Header Propagation:
uber-trace-id, baggage) is automatically extracted from incoming messages and injected into outgoing messages.Integration with OpenTracingBundle:
auxmoney/opentracing-bundle-core for global tracing configuration (e.g., Tracer setup, middleware).// Producer (automatically traced)
$this->rabbitMqProducer->publish('exchange', 'routing_key', $message);
// Consumer (automatically traced)
$this->rabbitMqConsumer->consume(function (Message $message) {
// Business logic here
});
Custom Span Naming:
OpentracingBundle-core.Error Handling:
error=true if exceptions occur during message processing.order-service → payment-service).trace_id across services.symfony/messenger + emag-tech-labs/rabbitmq-bundle, ensure the bundle’s decorators are loaded after Messenger’s RabbitMQ transport.OpentracingBundle-core to use your preferred tracer (e.g., Jaeger, Zipkin) via config/packages/opentracing.yaml.$this->tracer = $this->createMock(\OpenTracing\TracerInterface());
$this->container->set('opentracing.tracer', $this->tracer);
Deprecated Bundle:
auxmoney/OpentracingBundle-amqplib-RabbitMq. Migrate if possible.eMAGTechLabs/RabbitMqBundle is also abandoned; consider alternatives like php-amqplib or symfony/messenger with AMQP transport.Configuration Overrides:
RabbitMqProducerDecorator or RabbitMqConsumerDecorator classes.Header Conflicts:
Symfony 5+ Compatibility:
emag-tech-labs/rabbitmq-bundle).Consumer Lifecycle:
Missing Spans:
bin/console debug:container opentracing.tracer
var/log/dev.log or enable debug mode for OpentracingBundle-core.Header Propagation Issues:
rabbitmqctl list_queues or a packet sniffer to inspect message headers.$message = new Message(['traceparent' => '00-abc123...'], ['content_type' => 'text/plain']);
Performance Overhead:
OPENTRACING_ENABLED=0.Span Context:
$span->setTag('message.type', $message->getRoutingKey());
Custom Propagation:
x-request-id):
// In a custom decorator
$propagator = new CompositeTextMapAdapter([...]);
$propagator->inject($span->getContext(), $headers);
Legacy Systems:
$context = $propagator->extract(
\OpenTracing\FORMAT_TEXT_MAP,
$message->getHeaders()
);
$tracer->scopeManager()->activate($context, function() {
// Process message
});
Monitoring:
component=rabbitmq or span.kind=producer/consumer.Fallback for Errors:
OpentracingBundle-core to log errors when tracing fails:
# config/packages/opentracing.yaml
opentracing:
tracer:
fallback: true
How can I help you explore Laravel packages today?