-
Notifications
You must be signed in to change notification settings - Fork 174
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
RabbitMQ: Specify how to populate messaging.destination.name
#1531
base: main
Are you sure you want to change the base?
RabbitMQ: Specify how to populate messaging.destination.name
#1531
Conversation
docs/messaging/rabbitmq.md
Outdated
`messaging.destination.name` MUST be set to the name of the exchange. This will be an empty string if the default exchange is used. | ||
`messaging.destination.name` MUST be set according to the following rules: | ||
|
||
- Both *exchange* and *routing key* present and non-empty: `{exchange}:{routing key}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we have a problem on the consumer (even before this PR).
If someone publishes a message to exchange with a routing key and then there are bindings that route messages with this key to a queue (or queues) with a different name, then we have 3 things on the consumer side:
- we still have access to exchange and routing key - https://www.rabbitmq.com/docs/consumers#message-properties
- plus we have a queue name from which we got the message
and we have just two attributes (mesasging.destination.name
and messaging.rabbitmq.routing_key
) to store them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I also stumbled on the same thing, where does the queue fits into these two attributes. To make matters worse, for example in the Java instrumentation the Queue name is what is used for the Span name, not the exchange nor the routing key.
For the notes on messaging.destination.name
we have
Destination name SHOULD uniquely identify a specific queue, topic or other entity within the broker
It seems that for RabbitMQ (at least on the consumer side) that should be a combination of the three: exchange:routing_key:queue
. And it seems the same should also be used for {destination}
on the span name. I'm not sure it makes much sense to add a queue attribute, given the destination description already includes it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed a change, let me know what you think. b02ff2a
Fixes #1529
Changes
Specify in more detail how to populate
messaging.destination.name
for RabbitMQ. I based it on the Default exchange docs. My understanding is that arouting key
is always present, even when using the default exchange (empty in this case). The routing key then is the queue name.For all other cases, I left it as
amq.default
which is what RabbitMQ uses. I saw reference for it for example here: https://www.rabbitmq.com/docs/access-controlMerge requirement checklist
[chore]