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

Improve Spring-messaging transaction names and failure recognition #2812

Open
JonasKunz opened this issue Sep 29, 2022 · 1 comment
Open
Labels

Comments

@JonasKunz
Copy link
Contributor

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

@JonasKunz JonasKunz added the new-feature New feature label Sep 29, 2022
@eyalkoren
Copy link
Contributor

For the naming part, please take a look at this naming issue. I only collected the data and people thoughts, but it did not progress from there.
In the messaging section there were very few votes (I think there were no messaging instrumentations in most agents at the time I did this), but I think the preferable choice was going with the OTel schema.
Feel free to modify this issue or push this forward to any direction.

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

No branches or pull requests

2 participants