Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] php-amqplib Integration #1840

Closed
orlandothoeny opened this issue Dec 28, 2022 · 5 comments
Closed

[Feature] php-amqplib Integration #1840

orlandothoeny opened this issue Dec 28, 2022 · 5 comments

Comments

@orlandothoeny
Copy link

orlandothoeny commented Dec 28, 2022

As a developer, I'd like to see information about RabbitMQ messages inside traces.

Solution
Support for the php-amqplib library, which is as far as I could research the most widely used RabbitMQ client for PHP.

Alternatives I've considered
Implementing custom instrumentation myself. I would prefer to have this out of the box though.

Interesting methods
Methods I personally am interested in:

AMQPChannel

  • PhpAmqpLib\Channel\AMQPChannel::basic_publish()
  • PhpAmqpLib\Channel\AMQPChannel::basic_consume()
  • PhpAmqpLib\Channel\AMQPChannel::basic_get()
  • PhpAmqpLib\Channel\AMQPChannel::basic_ack()
  • PhpAmqpLib\Channel\AMQPChannel::basic_nack()
  • PhpAmqpLib\Channel\AMQPChannel::basic_cancel()

Especially interesting parameters: Exchange, Queue, Routing Key

AbstractConnection

  • PhpAmqpLib\Connection\AbstractConnection::connect()
  • PhpAmqpLib\Connection\AbstractConnection::reconnect()

It might make sense to extend this list.

@morrisonlevi
Copy link
Collaborator

morrisonlevi commented Dec 29, 2022

Thank you for including some interesting bits for us to investigate with this feature request!

A few notes while doing a tiny bit of research:

  • There's an RFC draft about propagating the trace context in the AMQP protocol: https://w3c.github.io/trace-context-amqp/. It was published 2022-03-21. This could potentially be used for connecting the distributed trace, if the info was added by the publisher.
  • Open Telemetry has some semantic conventions for messaging systems, which should be supported if possible. They define various span attributes, like messaging.system with a value of rabbitmq, and there's a RabbitMQ specific one: messaging.rabbitmq.routing_key.

@bwoebi
Copy link
Collaborator

bwoebi commented May 12, 2023

Hey @orlandothoeny,

We've just released 0.87.0 which includes an php-ampqlib integration!

Feel free to try it out and tell us whether it satisfies your expectations :-)

@bwoebi bwoebi closed this as completed May 12, 2023
@orlandothoeny
Copy link
Author

Hi @bwoebi,

Cool, great work!

What I observed in our setup:
We only have 2 resources: connect and one where we had a connection error and the whole PHP stack trace is used as resource name. But no basic_ack or basic_get, etc. which we also call.

image

@PROFeNoM
Copy link
Contributor

Hi @orlandothoeny,

There was indeed a dumb mistake that would cause an issue in the tracer when an error was happening during the connection.

Now, onto the fact that you only have 2 resources. Have you tried running with DD_TRACE_DEBUG set to 1? Is there anything special that stands out?

@orlandothoeny
Copy link
Author

Hi @PROFeNoM

Now we have proper resources, I can't reproduce it anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants