class StatsdTaggable::Client
Public Class Methods
new(config)
click to toggle source
# File lib/statsd-opentsdb-client/statsd_taggable.rb, line 8 def initialize(config) @host = config[:host] || 'localhost' @port = (config[:port] || 8125).to_i @app_name = config[:app_name] || "my_app" @tag_prefix = config[:tag_prefix] || '_t_' @hostname = `hostname`.split(".").first @client = Statsd.new(@host, @port) if config.include? :logger Statsd.logger = config[:logger] end @default_tags = { 'host' => @hostname, 'app' => @app_name } end
Public Instance Methods
Protected Instance Methods
sanitize(v)
click to toggle source
# File lib/statsd-opentsdb-client/statsd_taggable.rb, line 65 def sanitize v v.to_s.gsub ".", "_" end
with_tagged_name(metric, tags) { |encode_tags(metric, merge)| ... }
click to toggle source
# File lib/statsd-opentsdb-client/statsd_taggable.rb, line 55 def with_tagged_name (metric, tags) yield encode_tags(metric, tags.merge(@default_tags)) end