Class: Fluent::StatsdOutput
- Inherits:
-
BufferedOutput
- Object
- BufferedOutput
- Fluent::StatsdOutput
- Defined in:
- lib/fluent/plugin/out_statsd.rb
Instance Attribute Summary collapse
-
#statsd ⇒ Object
readonly
Returns the value of attribute statsd.
Instance Method Summary collapse
- #configure(conf) ⇒ Object
- #format(tag, time, record) ⇒ Object
-
#initialize ⇒ StatsdOutput
constructor
A new instance of StatsdOutput.
- #shutdown ⇒ Object
- #start ⇒ Object
- #write(chunk) ⇒ Object
Constructor Details
#initialize ⇒ StatsdOutput
Returns a new instance of StatsdOutput.
13 14 15 |
# File 'lib/fluent/plugin/out_statsd.rb', line 13 def initialize super end |
Instance Attribute Details
#statsd ⇒ Object (readonly)
Returns the value of attribute statsd.
11 12 13 |
# File 'lib/fluent/plugin/out_statsd.rb', line 11 def statsd @statsd end |
Instance Method Details
#configure(conf) ⇒ Object
17 18 19 20 |
# File 'lib/fluent/plugin/out_statsd.rb', line 17 def configure(conf) super @statsd = Statsd.new(host, port) end |
#format(tag, time, record) ⇒ Object
30 31 32 |
# File 'lib/fluent/plugin/out_statsd.rb', line 30 def format(tag, time, record) record.to_msgpack end |
#shutdown ⇒ Object
26 27 28 |
# File 'lib/fluent/plugin/out_statsd.rb', line 26 def shutdown super end |
#start ⇒ Object
22 23 24 |
# File 'lib/fluent/plugin/out_statsd.rb', line 22 def start super end |
#write(chunk) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/fluent/plugin/out_statsd.rb', line 34 def write(chunk) chunk.msgpack_each {|record| if statsd_type = record['statsd_type'] case statsd_type when 'timing' @statsd.timing record['statsd_key'], record['statsd_timing'].to_f when 'gauge' @statsd.gauge record['statsd_key'], record['statsd_gauge'].to_f when 'count' @statsd.count record['statsd_key'], record['statsd_count'].to_f when 'set' @statsd.set record['statsd_key'], record['statsd_set'] when 'increment' @statsd.increment record['statsd_key'] when 'decrement' @statsd.decrement record['statsd_key'] end end } end |