Class: Fluent::RootAgent::RootAgentProxyWithoutErrorCollector

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/fluent/root_agent.rb

Overview

<label @ERROR> element use RootAgent wrapped by # this RootAgentProxyWithoutErrorCollector. So that those elements don’t send cause infinite loop.

Instance Method Summary collapse

Constructor Details

#initialize(root_agent) ⇒ RootAgentProxyWithoutErrorCollector

Returns a new instance of RootAgentProxyWithoutErrorCollector.



297
298
299
300
301
302
303
304
305
# File 'lib/fluent/root_agent.rb', line 297

def initialize(root_agent)
  super

  @suppress_emit_error_log_interval = 0
  @next_emit_error_log_time = nil

  interval_time = root_agent.instance_variable_get(:@suppress_emit_error_log_interval)
  suppress_interval(interval_time) unless interval_time.zero?
end

Instance Method Details

#emit_error_event(tag, time, record, error) ⇒ Object



307
308
309
310
# File 'lib/fluent/root_agent.rb', line 307

def emit_error_event(tag, time, record, error)
  error_info = {error: error, tag: tag, time: time, record: record}
  log.warn "dump an error event in @ERROR:", error_info
end

#handle_emits_error(tag, es, e) ⇒ Object



312
313
314
315
316
317
318
319
320
# File 'lib/fluent/root_agent.rb', line 312

def handle_emits_error(tag, es, e)
  now = EventTime.now
  if @suppress_emit_error_log_interval.zero? || now > @next_emit_error_log_time
    log.warn "emit transaction failed in @ERROR:", error: e, tag: tag
    log.warn_backtrace
    @next_emit_error_log_time = now + @suppress_emit_error_log_interval
  end
  raise e
end