-
Notifications
You must be signed in to change notification settings - Fork 626
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
RabbitTemplate and RabbitListener add opentelemetry tags #2833
RabbitTemplate and RabbitListener add opentelemetry tags #2833
Conversation
17fb186
to
a330bc2
Compare
a330bc2
to
415a763
Compare
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.
Just one nit-pick.
When we merge this, tell us, please, if we are OK to contribute similar tags into the RabbitListenerObservation
.
Thanks.
.../main/java/org/springframework/amqp/rabbit/support/micrometer/RabbitTemplateObservation.java
Outdated
Show resolved
Hide resolved
.../main/java/org/springframework/amqp/rabbit/support/micrometer/RabbitTemplateObservation.java
Outdated
Show resolved
Hide resolved
@artembilan I can do the code for Listener as well, I'm not quite sure if "messaging.destination" sounds good when you are a receiver. |
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.
Checkstyle violations:
Error: eckstyle] [ERROR] /home/runner/work/spring-amqp/spring-amqp/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/support/micrometer/RabbitListenerObservation.java:70: First sentence should end with a period. [JavadocStyle]
> Task :spring-rabbit:checkstyleMain
Error: eckstyle] [ERROR] /home/runner/work/spring-amqp/spring-amqp/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/support/micrometer/RabbitListenerObservation.java:82: First sentence should end with a period. [JavadocStyle]
Error: eckstyle] [ERROR] /home/runner/work/spring-amqp/spring-amqp/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/support/micrometer/RabbitTemplateObservation.java:74: First sentence should end with a period. [JavadocStyle]
Error: eckstyle] [ERROR] /home/runner/work/spring-amqp/spring-amqp/spring-rabbit/src/main/java/org/springframework/amqp/rabbit/support/micrometer/RabbitTemplateObservation.java:87: First sentence should end with a period. [JavadocStyle]
Run ./gradlew check
locally before pushing to PR.
Thanks
Sorry, I didn't know IntelliJ needed a plugin for checkstyle... No more issues reported by Gradle |
}, | ||
|
||
/** | ||
* The exchange the listener is plugged to (empty if default exchange). |
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.
The listener deals with queues, not exchanges.
So, I believe here this has to be set into context.getCarrier().getMessageProperties().getConsumerQueue()
.
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.
done
ROUTING_KEY { | ||
@Override | ||
public String asString() { | ||
return "messaging.rabbitmq.destination.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.
This is totally wrong for consumer side.
See the messaging.rabbitmq.message.delivery_tag instead.
Can be set into a context.getCarrier().getMessageProperties().getDeliveryTag()
.
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.
done
RabbitListenerObservation.ListenerLowCardinalityTags.EXCHANGE.asString(), | ||
context.getCarrier().getMessageProperties().getReceivedExchange(), | ||
RabbitListenerObservation.ListenerLowCardinalityTags.ROUTING_KEY.asString(), | ||
context.getCarrier().getMessageProperties().getReceivedRoutingKey() |
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 for slight optimization the context.getCarrier().getMessageProperties()
could be extracted into a local variable.
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.
done
.../main/java/org/springframework/amqp/rabbit/support/micrometer/RabbitListenerObservation.java
Show resolved
Hide resolved
.../main/java/org/springframework/amqp/rabbit/support/micrometer/RabbitListenerObservation.java
Show resolved
Hide resolved
@@ -63,12 +60,35 @@ public enum ListenerLowCardinalityTags implements KeyName { | |||
* Listener id. | |||
*/ | |||
LISTENER_ID { | |||
|
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.
But this one has to be here for better code readability.
.../main/java/org/springframework/amqp/rabbit/support/micrometer/RabbitListenerObservation.java
Show resolved
Hide resolved
.../main/java/org/springframework/amqp/rabbit/support/micrometer/RabbitListenerObservation.java
Show resolved
Hide resolved
thank you for contribution; looking forward for more! |
closes #2814
added message.destination.name and message.rabbitmq.destination.routing_key as new tags for RabbitTemplateObservationConvention
added messaging.rabbitmq.message.delivery_tag and message.destination.name to RabbitListenerObservationConvention