added set metric output

This commit is contained in:
David Warden 2013-06-11 10:04:58 -04:00
parent 279711497a
commit 62f39154b9

View file

@ -52,6 +52,9 @@ class LogStash::Outputs::Statsd < LogStash::Outputs::Base
# A count metric. metric_name => count as hash
config :count, :validate => :hash, :default => {}
# A set metric. metric_name => string to append as hash
config :set, :validate => :hash, :default => {}
# The sample rate for the metric
config :sample_rate, :validate => :number, :default => 1
@ -90,6 +93,10 @@ class LogStash::Outputs::Statsd < LogStash::Outputs::Base
@client.timing(build_stat(event.sprintf(metric), sender),
event.sprintf(val).to_f, @sample_rate)
end
@set.each do |metric, val|
@client.set(build_stat(event.sprintf(metric), sender),
event.sprintf(val), @sample_rate)
end
end # def receive
def build_stat(metric, sender=@sender)