Class: Fluent::StatsitePlugin::StatsiteAggregateParser
- Inherits:
-
Object
- Object
- Fluent::StatsitePlugin::StatsiteAggregateParser
- Defined in:
- lib/fluent/plugin/statsite/parser.rb
Defined Under Namespace
Classes: TimerWatcher
Constant Summary collapse
- FLUSH_WAIT =
TODO: should be configurable?
0.5
Instance Method Summary collapse
- #call(io) ⇒ Object
- #each_line(line) ⇒ Object
- #flush ⇒ Object
-
#initialize(on_message, coolio_loop) ⇒ StatsiteAggregateParser
constructor
A new instance of StatsiteAggregateParser.
Constructor Details
#initialize(on_message, coolio_loop) ⇒ StatsiteAggregateParser
Returns a new instance of StatsiteAggregateParser.
53 54 55 56 57 |
# File 'lib/fluent/plugin/statsite/parser.rb', line 53 def initialize(, coolio_loop) @on_message = @loop = coolio_loop @buf = {} end |
Instance Method Details
#call(io) ⇒ Object
59 60 61 |
# File 'lib/fluent/plugin/statsite/parser.rb', line 59 def call(io) io.each_line(&method(:each_line)) end |
#each_line(line) ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/fluent/plugin/statsite/parser.rb', line 63 def each_line(line) record = parse_line(line) raise "out_statsite: failed to parse a line. '#{line}'" if record.nil? timer = TimerWatcher(FLUSH_WAIT, $log, method(&:flush)) end |
#flush ⇒ Object
71 72 73 |
# File 'lib/fluent/plugin/statsite/parser.rb', line 71 def flush @on_message.call(t.to_i, record) end |