-
Notifications
You must be signed in to change notification settings - Fork 169
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
Sinatra instrumentation does not add caught exceptions to the span #56
Comments
I think we could fix this pretty easily here: https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/instrumentation/sinatra/lib/opentelemetry/instrumentation/sinatra/middlewares/tracer_middleware.rb#L46 Something very easy like this (but adapted for the actual internals of the instrumentation) would do it: |
From the SIG - we should actually test this behavior on #54 first, because we suspect the Rack instrumentation actually does the right thing already. |
After #54 merged, I can confirm that we do not record the exception onto any spans. Rack seems to expect that We could try to figure out the exact way that Other options include hijacking Thoughts? |
Description of the bug
The Sinatra auto-instrumentation does not record exceptions as error logs on the span, despite using our
in_span
helper. This is because Sinatra does not necessarily barf on exceptions unless configured to do so - much like Rails, it catches those exceptions and returns an appropriate HTTP status code but it does not throw the exception. Thus,in_span
never has anything torescue
. This feels like a bug to me, but I'm not sure.Share details about your runtime
Operating system details:
Darwin janeway.local 21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:29 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T8101 arm64
RUBY_ENGINE:
ruby
RUBY_VERSION:
3.1.2
RUBY_DESCRIPTION:
ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin21]
Share a simplified reproduction if possible
You could trivially reproduce this by adding a
raise "boom"
into any of the examples we ship. The logged span from one such experiment looks like:(Note that while the span status seems correct, there are no log events that would record the error onto the span).
cc open-telemetry/opentelemetry-demo#158
The text was updated successfully, but these errors were encountered: