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

feat: record action dispatch exceptions in metal #667

Closed
wants to merge 1 commit into from
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
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ def dispatch(name, request, response)
if rack_span.recording?
rack_span.name = "#{self.class.name}##{name}" unless request.env['action_dispatch.exception']

if request.env['action_dispatch.exception']
rack_span.record_exception(request.env['action_dispatch.exception'])
end

attributes_to_append = {
OpenTelemetry::SemanticConventions::Trace::CODE_NAMESPACE => self.class.name,
OpenTelemetry::SemanticConventions::Trace::CODE_FUNCTION => String(name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@
get 'internal_server_error'

_(span.name).must_equal 'ExampleController#internal_server_error'
_(span.events[0].name).must_equal 'exception'
_(span.events[0].attributes['exception.type']).must_equal 'RuntimeError'
_(span.events[0].attributes['exception.message']).must_equal 'a little hell'
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ def new_item
end

def internal_server_error
raise :internal_server_error
raise 'a little hell'
end
end
Loading