Renaming Unicorn processes

心已入冬 提交于 2020-01-16 22:00:34

问题


I run a Linux server which hosts multiple small Rails apps (for better or worse). The problem is that all apps show up the same in ps (see output) and combined in New Relic's server monitoring (see screenshot).

$ ps -A
...
25902 ?        00:07:54 ruby
25905 ?        00:07:43 ruby
25914 ?        00:07:59 ruby
25916 ?        00:07:48 ruby
25931 ?        00:08:12 ruby
25935 ?        00:07:04 ruby
28316 ?        00:10:25 ruby
28319 ?        00:09:47 ruby
28548 ?        00:06:01 ruby
28550 ?        00:06:04 ruby
28553 ?        00:05:58 ruby
28561 ?        00:05:55 ruby
28855 ?        00:01:23 ruby
28859 ?        00:01:29 ruby
28896 ?        00:00:12 postgres
28900 ?        00:00:12 postgres
...

(I know there are many other options for ps's output, e.g. ps -auxf, but they don't really help the New Relic situation)

Ideally, I'd like each app to be identifiable in ps and New Relic, e.g.:

ruby_some_app (deployer)     480 MB
ruby_another_app (deployer)  260 MB
ruby_that_app (deployer)     512 MB
postgres (postgres)          272 MB

Is it possible to rename Unicorn masters and workers such that they don't just show up named "ruby"?

EDIT

I've hacked up some Rack middleware which successfully keeps $0 updated on every request. However, it doesn't make any difference on New Relic.

来源:https://stackoverflow.com/questions/29513119/renaming-unicorn-processes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!