Rate-Limit Number of Error Messages
Currently, an email is sent every time an error occurs. If the database server isn't reachable, this generates one message every few seconds. I would like to be able to limit the number of messages sent for the same error. So if the database team performs maintenance on the weekend and forgets to stop the website, we get hundreds of emails.
The simple solution would be to store the last error in memory and if another error occurs, check if it's different. If not, only send an email if x minutes have passed.
The better solution would be to store the error condition and only send one message per unique error and to send an "up again" message after the error condition is no longer present.