-
Notifications
You must be signed in to change notification settings - Fork 323
Description
At the moment messaging transactions are fully handled by the instrumentation of the used underlying messaging technology.
This means that for example Transactions are simply named like Receive message from Topic/Queue XY
.
Imo it would be more developer-friendly to do the naming similar to how we do it for spring-web-mvc
: We should use the actual entry-method into the user-code as transaction name. Depending on the used messaging technology, these are bean methods annotated with @KafkaListener
, @JmsListener
or @RabbitListener
.
In addition we currently are missing proper failure detection for spring message handlers. Spring catches exceptions thrown by the user-provided messagehandler, meaning that they never reach our messaging-technology instrumentation layer. It would be great to mark the transactions as failed and to record the exception when a handler throws one.
I didn't investiage further, but org.springframework.messaging.handler.invocation.InvocableHandlerMethod#invoke
looks like it might be a good universal instrumentation point for recording the method names of handlers registered via the annotations listed above.
However, we need to take care that we do not mess up the naming when listeners are registered programatically.
For the failure/exception detection we should use an instrumentation point which is used for both types of handlers (annotation-based and programatically registered).