2017-04-25 12:12:39 -04:00
|
|
|
require 'socket_server'
|
2017-04-21 10:24:43 -04:00
|
|
|
|
2017-04-25 12:12:39 -04:00
|
|
|
class StatsSocket < SocketServer
|
2017-04-21 10:24:43 -04:00
|
|
|
|
|
|
|
def initialize(socket_path)
|
2017-04-25 12:12:39 -04:00
|
|
|
super(socket_path)
|
2017-04-21 10:24:43 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
|
|
|
def get_response(command)
|
|
|
|
result =
|
|
|
|
case command
|
|
|
|
when "gc_stat"
|
|
|
|
GC.stat.to_json
|
|
|
|
else
|
|
|
|
"[\"UNKNOWN COMMAND\"]"
|
|
|
|
end
|
|
|
|
|
|
|
|
result << "\n"
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|