lib/ddtrace/contrib/rails/middlewares.rb in ddtrace-0.12.0.beta2 vs lib/ddtrace/contrib/rails/middlewares.rb in ddtrace-0.12.0.rc1
- old
+ new
@@ -20,11 +20,16 @@
# and it is user code which should be executed no matter what.
# It's not a problem since we re-raise it afterwards so for example a
# SignalException::Interrupt would still bubble up.
rescue Exception => e
tracer = Datadog.configuration[:rails][:tracer]
- span = tracer.active_span()
- span.set_error(e) unless span.nil?
+ span = tracer.active_span
+ unless span.nil?
+ # Only set error if it's supposed to be flagged as such
+ # e.g. we don't want to flag 404s.
+ # You can add custom errors via `config.action_dispatch.rescue_responses`
+ span.set_error(e) if Utils.exception_is_error?(e)
+ end
raise e
end
end
end
end