I'm attempting to create a Sinatra server that will return statistics about an EventMachine server. That is, I'm running:
EventMachine.run do
server = EventMachine.start_server 'localhost', 3333, MyApp
dispatch = Rack::Builder.app do
map '/' do
run MySinatraApp
end
end
Rack::Server.start({
app: dispatch,
server: 'thin',
Host: '0.0.0.0',
Port: '1111'
})
end
My goal is to figure out information on that running server started by start_server
, such as connection_count
. Is there any way to do this?
As far as I know there is no in-built way to do this (hopefully someone disproves me),
you can keep a counter in MyApp
and +1
on connect and -1
on unbind for same effect.