Following our passion for OSS and our love for Elixir, we released a new package that tells you when something went wrong on your Phoenix application. Go check it out and let us know what you think!
looks great! will give it a go in production soon.
Out of interest, why use this instead of centralised solution like Sentry, which also provides a lot of other features (like version tracking). Additionally from the code I see it will handle only errors raised in the router handlers, but will ignore exceptions outside that processes, so for example if I would do this in my handler:
spawn(fn -> raise "foo" end)
It will not handle such exception.
I just took a look at the source code really quick.
Email delivery looks like it happens during the request based on this line
mailer.deliver_now(email), instead of using Bamboo’s
Wouldn’t that mean if an exception happens, this plug will pick it up, then there will be an unknown amount of delay holding up the request until the email is sent? This could be anywhere from 500ms to 5000ms depending on what email provider you use and it’s unpredictable.
Is this a case where even a decent amount of exceptions being emailed could DDoS your site since every exception request would take 500ms+ to serve a response?
Thanks for your comment! We definitely have that on our roadmap, but you’re right it may lead to security breaches so I went ahead and created an issue to move that up on the priority list.
By the way you’re already using Bamboo to send the emails. It’s just you’re sending it “now” instead of “later”. Figured I’d add that here because the issue you opened is currently worded as
A suggestion could be sending emails in background, maybe via the use of Bamboo.
In either case Bamboo is used.
Nice catch! We’ve just published a new version with a fix for this
Hi! That’s a really good question.
We tried to create a library that is agnostic so you can use whichever service you want. Also, this allows you to use free services such as email, a custom webhook, or even so WhatsApp, Telegram, Slack and so.
We think it might be useful in this following scenarios:
- You don’t want to pay for an external service
- You have a high security or privacy restraints and you don’t want to expose your data
- You want to use a self-hosted service
Also, this is a port of a Ruby gem (exception_notification) that seems to be quite popular and we’d like to validate whether people are interested or there’s a real need to use something like this in Elixir.
Regarding the exceptions handling, I agree it will only catch errors in the routes so there’s still a lot of research and work to do for future versions.
But you are aware that you can self-host Sentry at ease.
With the above, you can integrate Sentry with most of these services.
In general, I am not saying no, but it seems very specific version that attach at the wrong place (instead it should be application that utilises
logger for catching error reports) that bring not much new to the table. So maybe you should check out Sentry, maybe that will fit your bill better, cleaner, and in more robust way.
To be fair self hosting and open source doesn’t necessarily mean free.
Their docs say 2.4gb of memory minimum to self host Sentry. On hosts like DigitalOcean and Linode you’re looking at $20 / month to get 4gb of memory. That could be more than your entire hosting costs for your web server + db + redis + etc… just to get notified for exceptions.
To be honest free-of-charge services doesn’t mean free services
Email, Slack, WhatsApp, Telegram, etc. also aren’t truly free, even if you do not pay for them.
And Sentry also have free plan for the beginnings of your journey.
In fact I found this thread searching for an Elixir/Phoenix equivalent of the said Ruby gem. Could you – BTW – update me/us on the current status? Would you call it “production ready” these days?
Saw a bugfix pushed the other day, thanks for keeping the package maintained!
Boom is still in a really early stage of development so it’s hard to promise we won’t make any breaking change in the future (even though we try not to). Also, you won’t have every functionality that the Ruby gem has.
This is the list of features we support so far
- Email and webhook notifier
- Support for implement a custom notifier
- Send errors to multiple notifiers
- Set how often do you want to receive the notifications (always or exponentially)
- Add custom metadata from the logger or the assigns
And this is the list of features we are planning to implement