-
Couldn't load subscription status.
- Fork 38.8k
Description
Hello,
I am using Spring Boot with Micrometer to monitor my application. Everything works well except for email monitoring. The JavaMailSenderImpl class does not support observation.
I created a decorator to solve this issue, but it's not perfect. I had to bridge the send(MimeMessage... mimeMessages) method to the send(MimeMessage mimeMessage) method. This has the side effect of reopening the Transport for each MimeMessage.
Before submitting a pull request, I would like to discuss two possible solutions with you:
Option 1: Register TransportListener
- Add the ability to register a
TransportListenerfor all createdTransportobjects. - Pros:
- Useful for metrics: We can count delivered, not delivered, and partially delivered messages.
- Spring does not need to add a custom class to support this.
- Cons:
- Not useful for tracing: We cannot surround the network call.
Option 2: New MailSendListener Interface
- Create a new interface,
MailSendListener, dedicated to mail observations, similar to Spring Data MongoDB. - Pros:
- Useful for metrics: We can count delivered, not delivered, and partially delivered messages.
- Useful for tracing: We can surround the network call.
- Cons:
- Spring needs to add a custom interface to support this.
Please let me know your thoughts on these options.
Thank you!