Set FOREMAN_PROCESS_NAME env var for spawned procs
This way, processes can identify themselves to metrics logging systems.
This commit is contained in:
1 parent
7be4375168
commit
95a1d49e9d
1 file changed
+6
-1
@@ -307,6 +307,10 @@ private
|
|||||||
|
|
||||||
def name_for(pid)
|
def name_for(pid)
|
||||||
process, index = @running[pid]
|
process, index = @running[pid]
|
||||||
|
name_for_index(process, index)
|
||||||
|
end
|
||||||
|
|
||||||
|
def name_for_index(process, index)
|
||||||
[ @names[process], index.to_s ].compact.join(".")
|
[ @names[process], index.to_s ].compact.join(".")
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -355,7 +359,8 @@ private
|
|||||||
reader, writer = create_pipe
|
reader, writer = create_pipe
|
||||||
begin
|
begin
|
||||||
pid = process.run(:output => writer, :env => {
|
pid = process.run(:output => writer, :env => {
|
||||||
"PORT" => port_for(process, n).to_s
|
"PORT" => port_for(process, n).to_s,
|
||||||
|
"FOREMAN_PROCESS_NAME" => name_for_index(process, n)
|
||||||
})
|
})
|
||||||
writer.puts "started with pid #{pid}"
|
writer.puts "started with pid #{pid}"
|
||||||
rescue Errno::ENOENT
|
rescue Errno::ENOENT
|
||||||
|
|||||||
Reference in new issue
Block a user