gpt4 book ai didi

ruby-on-rails - 如何在 Heroku 中设置内存使用警报?

转载 作者:行者123 更新时间:2023-12-03 23:50:44 25 4
gpt4 key购买 nike

那,基本上。我有一个 Rails 5 应用程序,但实际上更多的是在一般级别上,当我的 dynos 达到特定内存使用阈值时,我试图找到一种方法来获取电子邮件警报。我使用一个网络和一个 worker 。找不到任何东西。

最佳答案

Heroku 有一个“应用程序指标”页面,它也可以在某些情况下提醒您。但是,没有用于提醒内存使用情况的选项。我们已经询问了 Heroku 的支持,这是他们的回答:

Yes, unfortunately there's not a built-in way to receive alerts about memory usage. However, you could potentially set up your Papertrail instance to alert you if your app emits an R14 or an R15. Keep in mind that those are cases where it might be too late to take any corrective action on memory as it is already alerting a disruption to the app.

For more granularity, you'll need to enable the log-runtime-metrics lab so that your memory usage is printed to your application logs: https://devcenter.heroku.com/articles/log-runtime-metrics.

You can also use a log drain to parse, chart, and setup alerts for those errors. Librato is the most common tool I see customers using for that kind of workflow: https://elements.heroku.com/addons/librato.



目前,依靠 Papertrail 对我们来说已经足够了,但我们仍在探索其他选择。一种选择是简单地使用 Rails 应用程序报告它自己的内存使用情况,例如通过这样的系统调用 pmap #{Process.pid} | tail -1 .另一种选择是使用 Monit ( https://mmonit.com/ ),但设置和配置它并不容易。 (您需要一个自定义构建包才能在 Heroku 上运行它。)此外,Heroku 还支持一些 3rd 方插件进行监控,这些插件可以发送警报,例如 New Relic。

关于ruby-on-rails - 如何在 Heroku 中设置内存使用警报?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58263795/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com