문제

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).

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.

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

도움이 되었습니까?

해결책 2

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.

다른 팁

Check out God. There is even a nice Railscast about it.

Monit is also a good alternative.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top