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.



289
290
291
292
293
294
295
296
297
# File 'lib/fluent/root_agent.rb', line 289

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



299
300
301
302
# File 'lib/fluent/root_agent.rb', line 299

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



304
305
306
307
308
309
310
311
312
# File 'lib/fluent/root_agent.rb', line 304

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