37 lines
686 B
Ruby
37 lines
686 B
Ruby
require 'json'
|
|
require 'resque'
|
|
require 'resque-retry'
|
|
require 'net/http'
|
|
require 'digest/md5'
|
|
|
|
module JamRuby
|
|
|
|
# creates stats to send to influx periodically
|
|
class StatsMaker
|
|
extend Resque::Plugins::JamLonelyJob
|
|
|
|
@queue = :scheduled_db_metrics
|
|
|
|
def log
|
|
@log || Logging.logger[StatsMaker]
|
|
end
|
|
|
|
def self.lock_timeout
|
|
120
|
|
end
|
|
|
|
|
|
def self.perform
|
|
StatsMaker.new.run
|
|
end
|
|
|
|
def run
|
|
log.debug("starting...")
|
|
Stats.write('connection', Connection.stats)
|
|
Stats.write('users', User.stats)
|
|
Stats.write('sessions', ActiveMusicSession.stats)
|
|
Stats.write('jam_track_rights', JamTrackRight.stats)
|
|
end
|
|
end
|
|
|
|
end |