Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log: add caller plugin-id about emitting error events #4632

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/fluent/agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def add_filter(type, pattern, conf)
end

# For handling invalid record
def emit_error_event(tag, time, record, error)
def emit_error_event(tag, time, record, error, plugin_id: nil)
end

def handle_emits_error(tag, es, error)
Expand Down
2 changes: 1 addition & 1 deletion lib/fluent/event_router.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def emit_stream(tag, es)
end

def emit_error_event(tag, time, record, error)
@emit_error_handler.emit_error_event(tag, time, record, error)
@emit_error_handler.emit_error_event(tag, time, record, error, plugin_id: @caller_plugin_id)
end

def match?(tag)
Expand Down
4 changes: 2 additions & 2 deletions lib/fluent/label.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ def configure(conf)
end
end

def emit_error_event(tag, time, record, e)
@root_agent.emit_error_event(tag, time, record, e)
def emit_error_event(tag, time, record, e, plugin_id: nil)
@root_agent.emit_error_event(tag, time, record, e, plugin_id: plugin_id)
end

def handle_emits_error(tag, es, e)
Expand Down
3 changes: 2 additions & 1 deletion lib/fluent/root_agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,9 @@ def find_label(label_name)
end
end

def emit_error_event(tag, time, record, error)
def emit_error_event(tag, time, record, error, plugin_id: nil)
error_info = {error: error, location: (error.backtrace ? error.backtrace.first : nil), tag: tag, time: time}
error_info[:plugin_id] = plugin_id if plugin_id
if @error_collector
# A record is not included in the logs because <@ERROR> handles it. This warn is for the notification
log.warn "send an error event to @ERROR:", error_info
Expand Down
Loading