rubyexceptionopentracingsignalfx

SignalFx: Report a rescued exception in Ruby code, similar to NewRelic::Agent.notice_error?


In a Ruby on Rails app, I rescue an exception in a known scenario. In the rescue, my code does a little clean up then moves on without re-raising the exception.

I want to log details of the exception to SignalFx. I believe this happens automatically if the exception is not rescued. But in this case I need to rescue it.

We are currently migrating from New Relic to SignalFx. In New Relic, I could force the rescued exception to be logged like this:

rescue MySpecialError => ex
  NewRelic::Agent.notice_error ex
  record.clean_up_after_my_special_error()

This would record the stack trace, request params, env vars, etc, exactly as if the exception was not rescued.

Is there a similar way with SignalFx to capture rich exception information without raising the exception?


Solution

  • According to the docs,

    client = SignalFx.new 'MY_SIGNALFX_TOKEN'
    client.send_event('EXCEPTION', ... )
    

    You may want to consider using a more focused error-reporting service.