Class: Fluent::StatsiteFilterOutput
- Inherits:
-
BufferedOutput
- Object
- BufferedOutput
- Fluent::StatsiteFilterOutput
- Includes:
- StatsitePlugin
- Defined in:
- lib/fluent/plugin/out_statsite_filter.rb
Constant Summary collapse
- CONFIG_VALIDATION_WAIT =
TODO: should be configurable?
0.1
Instance Method Summary collapse
- #before_shutdown ⇒ Object
- #configure(conf) ⇒ Object
- #format(tag, time, record) ⇒ Object
-
#initialize ⇒ StatsiteFilterOutput
constructor
TODO: should support input_counter?.
- #shutdown ⇒ Object
- #start ⇒ Object
- #write(chunk) ⇒ Object
Constructor Details
#initialize ⇒ StatsiteFilterOutput
TODO: should support input_counter?
30 31 32 |
# File 'lib/fluent/plugin/out_statsite_filter.rb', line 30 def initialize super end |
Instance Method Details
#before_shutdown ⇒ Object
69 70 71 72 73 74 |
# File 'lib/fluent/plugin/out_statsite_filter.rb', line 69 def before_shutdown super $log.debug "out_statsite#before_shutdown called" @child.finished = true sleep 0.5 # TODO wait time before killing child process end |
#configure(conf) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/fluent/plugin/out_statsite_filter.rb', line 34 def configure(conf) super @metrics = validate_metrics @metrics.each{|m| @log.info "out_statsite: #{m}"} @histograms = validate_histograms @respawns = configure_respawns @parser = StatsiteParser.new(method(:on_message)) @formatter = StatsiteFormatter.new(@metrics) $log.info "out_statsite: statsite config\n\n#{config}" @conf = Tempfile.new('fluent-plugin-statsite-') @conf.puts config @conf.flush @child = ChildProcess.new(@parser, @respawns, log) @cmd = "#{@statsite_path} -f #{@conf.path}" validate_statsite_confg end |
#format(tag, time, record) ⇒ Object
82 83 84 |
# File 'lib/fluent/plugin/out_statsite_filter.rb', line 82 def format(tag, time, record) @formatter.call(record) end |
#shutdown ⇒ Object
76 77 78 79 80 |
# File 'lib/fluent/plugin/out_statsite_filter.rb', line 76 def shutdown super @conf.close @child.shutdown end |
#start ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/fluent/plugin/out_statsite_filter.rb', line 57 def start super begin $log.info "out_statsite: launching statsite process", cmd: @cmd @child.start(@cmd) rescue shutdown raise end end |
#write(chunk) ⇒ Object
86 87 88 |
# File 'lib/fluent/plugin/out_statsite_filter.rb', line 86 def write(chunk) @child.write chunk end |