bin/instrument_server in instrumental_tools-0.5.4 vs bin/instrument_server in instrumental_tools-0.5.5
- old
+ new
@@ -325,10 +325,11 @@
end
class ServerController < Pidly::Control
COMMANDS = [:start, :stop, :status, :restart, :clean, :kill]
+ REPORT_INTERVAL = 60
attr_accessor :run_options
before_start do
puts "Starting daemon process: #{@pid}"
@@ -349,12 +350,12 @@
def self.run(options)
agent = Instrumental::Agent.new(options[:api_key], :collector => [options[:collector], options[:port]].compact.join(':'))
puts "Collecting stats under the hostname: #{options[:hostname]}"
loop do
t = Time.now.to_i
- next_minute = (t - t % 60) + 60
- sleep [next_minute - t, 0].max
+ next_run_at = (t - t % REPORT_INTERVAL) + REPORT_INTERVAL
+ sleep [next_run_at - t, 0].max
inspector = SystemInspector.new
inspector.load_all
inspector.gauges.each do |stat, value|
agent.gauge("#{options[:hostname]}.#{stat}", value)
end
@@ -381,10 +382,10 @@
end
end
options = {
:daemon => false,
- :collector => 'instrumentalapp.com',
+ :collector => 'collector.instrumentalapp.com',
:port => '8000',
:hostname => Socket.gethostname,
}
option_parser = OptionParser.new do |opts|