Search code examples
airbrake

How to ignore_user_agent in Airbrake 5?


We are migrating to Airbrake 5 and I'm wondering how to replace the functionality of the ignore_user_agent configuration. I know we have to check in an add_filter block, but not sure what/where to check?

Does anyone have an example of replacing the ignore_user_agent configuration option in Airbrake 5?


Solution

  • That would be easy (assuming this fix is merged in and the new gem is published):

    Airbrake.add_filter do |notice|
      notice.ignore! if notice[:context][:userAgent].match(/curl/)
    end
    

    In the meantime, you can use the class add_filter API.

    From: https://github.com/airbrake/airbrake-ruby/issues/9

    EDIT: the new gem was published.