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

OpenTelemetry with RabbitMQ add messaging.rabbitmq.destination.routing_key from the semantic convention #2814

Closed
vmeunier opened this issue Sep 11, 2024 · 2 comments · Fixed by #2833
Labels
ideal-for-user-contribution An issue that would ideal for a user to get started with contributing. type: enhancement
Milestone

Comments

@vmeunier
Copy link
Contributor

vmeunier commented Sep 11, 2024

Expected Behavior

There are several fields in the semantic convention for RabbitMQ and RabbitTemplate is missing the one named messaging.rabbitmq.destination.routing_key.

Current Behavior

At the moment, in RabbitTemplate, the observationContext concatenates "exchange/routingKey" in the field messaging.destination.name

Context

If we want to be fully "OpenTelemetry compliant" then we should use all the fields we can with the information we have.
IMO it is a mistake to concatenate two different strings in one, it makes the research or filtering in traces/metrics afterwards more complicated.

messaging.destination.name must be the name of the exchange
messaging.rabbitmq.destination.routing_key must be the name of the routingKey

In RabbitMQ, the destination is defined by an exchange and a routing key. messaging.destination.name MUST be set to the name of the exchange. This will be an empty string if the default exchange is used.

EDIT :

We can also add somes tags for RabbitListenerObservationConvention :
messaging.destination.name which will be the consumerQueue
messaging.rabbitmq.message.delivery_tag the delivery tag of the message being processed

@artembilan
Copy link
Member

We do not follow those conventions by default because of Status: Experimental.
However additional tags to whatever we have chosen by default would not harm.
In fact we had similar contribution in the past into Spring for Apache Kafka: spring-projects/spring-kafka#2609.

So, feel free to raise respective PR and we will be more than happy to review and merge!

@artembilan artembilan added ideal-for-user-contribution An issue that would ideal for a user to get started with contributing. and removed status: waiting-for-triage labels Sep 11, 2024
@vmeunier
Copy link
Contributor Author

Ok, i'll try to send you a PR :)

@artembilan artembilan added this to the 3.2.0-RC1 milestone Sep 18, 2024
artembilan pushed a commit that referenced this issue Sep 19, 2024
Fixes: #2814
Issue link: #2814

* Add Opentelemetry tags `RabbitTemplate `
* Add Opentelemetry tags `RabbitListenerObservationConvention`
artembilan added a commit that referenced this issue Oct 1, 2024
* Fix `ObservationTests` for the latest changes with default tags.
Related to: #2814
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ideal-for-user-contribution An issue that would ideal for a user to get started with contributing. type: enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants