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

RabbitMQ: Specify how to populate messaging.destination.name #1531

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

joaopgrassi
Copy link
Member

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 a routing 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-control

For convenience RabbitMQ maps AMQP 0-9-1's default exchange's blank name to 'amq.default' when performing permission checks.

Merge requirement checklist

`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}`
Copy link
Contributor

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).

image

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:

and we have just two attributes (mesasging.destination.name and messaging.rabbitmq.routing_key) to store them

Copy link
Member Author

@joaopgrassi joaopgrassi Oct 31, 2024

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.

Copy link
Member Author

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

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

Successfully merging this pull request may close these issues.

[Messaging RabbitMQ] What to use for destination.name when the default exchange is used (empty string)
2 participants