ekmartin / slack-irc

Connects Slack and IRC channels by sending messages back and forth.
MIT License
587 stars 155 forks source link

Add health check endpoint #117

Open JosephSalisbury opened 8 years ago

JosephSalisbury commented 8 years ago

Hello! Thanks for this project, we've been using it for the last couple of months.

It would be super useful for us if slack-irc exposed a http health endpoint, so we can add it into our monitoring. Any endpoint that we can use to integrate with Pingdom would be great (green if slack-irc is connected to Slack and IRC, for example).

For background, we're using slack-irc at Giant Swarm, and we're running it on our own cloud infrastructure. We've occasionally seen errors (normally us :D ), and would like to have health checking so we can be informed if there are any issues, instead of having to find out manually.

Thanks

ekmartin commented 8 years ago

Hi! Sorry for the extremely late answer. I'm a bit unsure about this one, as I'm a bit concerned about adding a listen port to an application that doesn't have one from before.

At the moment slack-irc should attempt to reconnect to both Slack and IRC multiple times, but naturally there'll be times were this won't be enough. Maybe a better solution would be to crash the application whenever this happens, so that it can be restarted? This should probably be fixed regardless though, especially if it gets stuck in some kind of limbo of not trying to reconnect at all after a while.

JosephSalisbury commented 8 years ago

Heyo!

Crashing if connections can't be made could help, yeah. We'd have to see if this fixes overall, I'm not certain.

My only concern is that if a connection cannot be made, the difference with crashing is just that the application crash-loops instead of hanging - ops still wouldn't know to attend to it. Maybe put the healthcheck under a configuration option?

filler commented 8 years ago

Ive done something similar like this to shove the bot onto Heroku. Basically pull in express via package.json and swizzle index.js to listen if it detects Heroku, serve some rando payload from the Heroku endpoint, voila!