Class: Mysql::Statsd::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/mysql-statsd.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config_path) ⇒ Runner

Returns a new instance of Runner.



11
12
13
# File 'lib/mysql-statsd.rb', line 11

def initialize(config_path)
  @config ||= YAML.load_file config_path
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



9
10
11
# File 'lib/mysql-statsd.rb', line 9

def config
  @config
end

Instance Method Details

#mysqlObject



25
26
27
# File 'lib/mysql-statsd.rb', line 25

def mysql
  @mysql ||= Mysql2::Client.new config['mysql']
end

#run!Object



15
16
17
18
19
# File 'lib/mysql-statsd.rb', line 15

def run!
  instrument_statuses
  instrument_process_list
  instrument_queries
end

#statsdObject



21
22
23
# File 'lib/mysql-statsd.rb', line 21

def statsd
  @statsd ||= ::Statsd.new(config['statsd']['host']).tap { |sd| sd.namespace = config['statsd']['namespace'] }
end