appsignal/appsignal-ruby

Sanitization hook for errors

Closed this issue · 3 comments

Timebox: 2 days

Description

Some customers need to strip some information from error messages. Can we provide a hook to make doing this manually, but with a stable API, possible?

Idea

It would be nice if we could offer a way to sanitize the entire transaction (I'm sure there's another issue for this somewhere). The problem with sanitizing the transaction object, is that the error is not stored on the transaction's Ruby class, so I'm not sure how easy it will be to modify the previously set error object.

Some random pseudocode ideas:

Appsignal.modify_error do |error|
  error.message = "sanitized"
  error
end

Appsignal.modify_transaction do |transaction|
  transaction.params = nil
  transaction.error.name = nil
end

To do

  • Check if modify_transaction (with error modification) is possible.
    • Note that the error is not stored on the Transaction class in Ruby, so modifying it might not be possible. We could store it on the Transaction class, and set it before the transaction is closed, or when set_sample_data is called. Something that is always called.
    • If it turns out it's not possible, implement modify_error instead that triggers on calls to set_error (and send_error).
  • Add to docs.
  • Blog post, suggest to the blog team.

Closing this issue to avoid confusion with above mentioned issue.