Customizing Error Grouping
Honeybadger groups similar exceptions together using rules which we’ve found to work the best in most cases. The default information we use to group errors is:
- The file name, method name, and line number of the error’s location
- The class name of the error
- The component/controller name
We use this information to construct a “fingerprint” of the exception. Exceptions with the same fingerprint are treated as the same error in Honeybadger.
You can customize the grouping for each exception by changing the error class name, component, or stack trace—or by sending a custom fingerprint.
There are two ways you can customize the fingerprint: globally (for all
exceptions that are reported from your app), and locally (when calling
Honeybadger.notify
).
Customizing the Grouping for all Exceptions
The Honeybadger.before_notify
callback in conjunction with the
Notice#fingerprint
method allows you to change the fingerprint of a
notice to properly group the same notices.
Honeybadger.configure do |config|
config.before_notify do |notice|
notice.fingerprint = [notice.error_class,
notice.component, notice.backtrace.join(',')].join(':')
end
end
For a list of properties available on the notice
parameter, see the API
reference.
Customizing the Grouping for Honeybadger.notify
The :fingerprint
option can be used to override the fingerprint for an
exception reported with Honeybadger.notify
:
Honeybadger.notify(exception, fingerprint: 'a unique string')