Sha256: 5d9cf9442aed6f07050f0f92a8a58485c8f8c96013125834c99de0c547b1882c
Contents?: true
Size: 941 Bytes
Versions: 2
Compression:
Stored size: 941 Bytes
Contents
require 'statsd' module AdhearsionStats class << self attr_accessor :statsd, :loaded, :metrics_logger end class Plugin < Adhearsion::Plugin config :statsd do host "127.0.0.1", desc: "The host that statsd is found at" port 8125, desc: "The port that statsd is found at" log_metrics false, desc: "Whether or not to log stats sent to statsd" end init :statsd do AdhearsionStats.setup_logger if Adhearsion.config.statsd.log_metrics AdhearsionStats.statsd = Statsd.new Adhearsion.config.statsd.host, Adhearsion.config.statsd.port AdhearsionStats.loaded = true logger.info "Adhearsion-Stats has been loaded" end end class << self def method_missing(meth, *args, &blk) if Adhearsion.config[:statsd].log_metrics metrics_logger.send :info, "#{meth}(#{args.join(",")})" end AdhearsionStats.statsd.send meth, *args end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
adhearsion-stats-0.0.2 | lib/adhearsion-stats/plugin.rb |
adhearsion-stats-0.0.1 | lib/adhearsion-stats/plugin.rb |