Class: Fluent::RootAgent::RootAgentProxyWithoutErrorCollector
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Fluent::RootAgent::RootAgentProxyWithoutErrorCollector
- 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
- #emit_error_event(tag, time, record, error) ⇒ Object
- #handle_emits_error(tag, es, e) ⇒ Object
-
#initialize(root_agent) ⇒ RootAgentProxyWithoutErrorCollector
constructor
A new instance of RootAgentProxyWithoutErrorCollector.
Constructor Details
#initialize(root_agent) ⇒ RootAgentProxyWithoutErrorCollector
Returns a new instance of RootAgentProxyWithoutErrorCollector.
205 206 207 208 209 210 211 212 213 |
# File 'lib/fluent/root_agent.rb', line 205 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
215 216 217 218 |
# File 'lib/fluent/root_agent.rb', line 215 def emit_error_event(tag, time, record, error) error_info = {error_class: error.class, error: error.to_s, tag: tag, time: time, record: record} log.warn "dump an error event in @ERROR:", error_info end |
#handle_emits_error(tag, es, e) ⇒ Object
220 221 222 223 224 225 226 227 228 |
# File 'lib/fluent/root_agent.rb', line 220 def handle_emits_error(tag, es, e) now = Engine.now if @suppress_emit_error_log_interval.zero? || now > @next_emit_error_log_time log.warn "emit transaction failed in @ERROR:", error_class: e.class, error: e, tag: tag log.warn_backtrace @next_emit_error_log_time = now + @suppress_emit_error_log_interval end raise e end |