lib/metricize/client.rb in metricize-0.5.0 vs lib/metricize/client.rb in metricize-0.5.1
- old
+ new
@@ -2,14 +2,13 @@
class Client
include SharedMethods
def initialize(options = {})
@prefix = options[:prefix]
- @sampling_ratio = options[:sampling_ratio] || 0.10
+ @log_sampling_ratio = options[:log_sampling_ratio] || 0.10
establish_logger(options)
initialize_redis(options)
- establish_redis_connection
end
def increment(name, options = {})
count = options.delete(:by) || 1
enqueue_count(name, count, options)
@@ -41,10 +40,10 @@
def push_to_queue(name, value, options)
data = prepare_metric(name, value, options).to_json
with_error_handling do
@redis.lpush(@queue_name, data)
end
- return unless rand < @sampling_ratio
+ return unless rand < @log_sampling_ratio
msg = "#{name.gsub('.', '_')}=#{value}" # splunk chokes on dots in field names
msg << ", metric_source=#{options[:source].gsub('.', '_')}" if options[:source]
log_message msg, :info
end