简体   繁体   English

Heroku上的Rails如何监视工作进程

[英]Rails on Heroku how to monitor worker process

I have a critical worker process for my Rails app that is an event machine loop on twitter feed events (Someone tweets, it automatically processes the tweet and runs different code based on content, otherwise known as the tweetstream gem). 我的Rails应用程序有一个关键的工作进程,它是Twitter提要事件上的事件机循环(有人发推文,它会自动处理该推文并根据内容运行不同的代码,也称为tweetstream gem)。

My issue is that I'm unaware of the correct/good ways to monitor a process in production, such that if the process goes down or isn't working correctly I want to be notified in some way or another so I can try to address it quickly. 我的问题是我不知道在生产中监视流程的正确/良好方法,因此,如果流程出现故障或无法正常运行,我希望以某种方式得到通知,以便我尝试解决它很快。 I have the NewRelic gem to monitor my web server, but haven't been sure if/how it applies to worker threads. 我有NewRelic gem来监视我的Web服务器,但不确定是否/如何将其应用于辅助线程。

What I'm looking for: 我在寻找什么:

  • Ensure process itself is running at all times, or be notified if not 确保流程本身始终在运行,否则请通知流程
  • Ensure that events (receiving tweet) cause code to run all the way through (be notified if an error is thrown before completion and where) 确保事件(接收推文)使代码一直运行(在完成之前以及在何处引发错误时得到通知)
  • Possibly ensure that some invariants are being held, or notified if not 可能确保保留某些不变式,如果没有,则通知

It's possible what I'm looking for is part of the normal logger workflow, (using different log levels?) If so, confirmation of that would also be pretty helpful for me. 我正在寻找的可能是常规记录器工作流程的一部分(使用不同的日志级别?)。如果是这样,确认这一点对我也很有帮助。 Any advice is appreciated, thank you! 任何建议表示赞赏,谢谢!

EDIT: Said NewEgg instead of NewRelic...oops 编辑:说NewEgg而不是NewRelic ... oops

Check out God . 看看上帝 There is even a nice Railscast about it. 甚至还有一个不错的Railscast

Monit is also a good alternative. Monit也是一个不错的选择。

The latter two requirements could be done using logging, but it would require some work to send you email notifications when an event fails to run all the way through your code or is being held. 后两个要求可以使用日志记录来完成,但是当事件无法一直贯穿您的代码或一直被保留时,需要做一些工作才能向您发送电子邮件通知。

You might want to check out the NewRelic plugin on Heroku - it's now free for a small number of dynos, and that can alert you if the process is running at all times and notify you if it is not. 您可能想查看Heroku上的NewRelic插件-少数测功机现在免费,该插件可以一直提醒您该进程是否一直在运行,如果尚未运行,则通知您。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM